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