Add a input type
This commit is contained in:
parent
e351f30d4a
commit
65d70a4f6d
4 changed files with 24 additions and 9 deletions
|
@ -2,5 +2,5 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class LibACFlutterConstants {
|
||||
static const Color TITLEBAR_COLOR = Color.fromARGB(255, 99, 0, 0);
|
||||
static const VERSION = "1.0.013125+0327";
|
||||
static const VERSION = "1.0.013125+0358";
|
||||
}
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
///
|
||||
enum InputPromptType { Text, Number }
|
||||
|
||||
/// Prompt which enables the input of data
|
||||
class InputPrompt extends StatefulWidget {
|
||||
String title;
|
||||
String prompt;
|
||||
String currentValue;
|
||||
InputPromptType type;
|
||||
|
||||
InputPrompt(
|
||||
{super.key,
|
||||
required this.title,
|
||||
required this.prompt,
|
||||
required this.currentValue});
|
||||
required this.currentValue,
|
||||
required this.type});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return InputPromptState(
|
||||
title: title, prompt: prompt, currentValue: currentValue);
|
||||
title: title, prompt: prompt, currentValue: currentValue, type: type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,10 +27,14 @@ class InputPromptState extends State<InputPrompt> {
|
|||
String title;
|
||||
String prompt;
|
||||
String currentValue;
|
||||
InputPromptType type;
|
||||
TextEditingController textField = TextEditingController();
|
||||
|
||||
InputPromptState(
|
||||
{required this.title, required this.prompt, required this.currentValue}) {
|
||||
{required this.title,
|
||||
required this.prompt,
|
||||
required this.currentValue,
|
||||
required this.type}) {
|
||||
textField.text = currentValue;
|
||||
}
|
||||
|
||||
|
@ -40,9 +48,15 @@ class InputPromptState extends State<InputPrompt> {
|
|||
child: Column(
|
||||
children: [
|
||||
Text(prompt),
|
||||
TextField(
|
||||
controller: textField,
|
||||
)
|
||||
if (type == InputPromptType.Text)
|
||||
TextField(
|
||||
controller: textField,
|
||||
),
|
||||
if (type == InputPromptType.Number)
|
||||
TextField(
|
||||
controller: textField,
|
||||
keyboardType: TextInputType.number,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: libacflutter
|
||||
description: "A new Flutter package project."
|
||||
version: 1.0.013125+0327
|
||||
version: 1.0.013125+0358
|
||||
homepage: https://zontreck.com
|
||||
publish_to: https://git.zontreck.com/api/packages/AriasCreations/pub
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ class TestPromptState extends State<TestPrompt> {
|
|||
title: "Test",
|
||||
prompt: "Enter a value",
|
||||
currentValue: "",
|
||||
type: InputPromptType.Text,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue