diff --git a/lib/Constants.dart b/lib/Constants.dart index 369e4be..65048c5 100644 --- a/lib/Constants.dart +++ b/lib/Constants.dart @@ -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.020325+1224"; + static const VERSION = "1.0.031525+0222"; } diff --git a/lib/TextFields.dart b/lib/TextFields.dart new file mode 100644 index 0000000..5a963a2 --- /dev/null +++ b/lib/TextFields.dart @@ -0,0 +1,75 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; + +enum InputType { + Text, + Number, + Date; + + TextInputType getType() { + switch (this) { + case Text: + return TextInputType.text; + case Number: + return TextInputType.number; + case Date: + return TextInputType.datetime; + } + } + + List getFormatters() { + var lst = []; + + switch (this) { + case Text: + return [FilteringTextInputFormatter.deny("")]; + case Number: + return [FilteringTextInputFormatter.digitsOnly]; + case Date: + return [ + FilteringTextInputFormatter.digitsOnly, + FilteringTextInputFormatter.allow("-"), + FilteringTextInputFormatter.allow("/") + ]; + } + } +} + +class HighlightTextfield extends StatelessWidget { + TextEditingController controller; + InputType inputStyle; + Color selected; + Color inactive; + HighlightTextfield( + {required this.controller, + required this.inputStyle, + required this.selected, + required this.inactive}); + + @override + Widget build(BuildContext context) { + return TextField( + controller: controller, + keyboardType: inputStyle.getType(), + inputFormatters: inputStyle.getFormatters(), + decoration: InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: selected, + ), + ), + border: OutlineInputBorder( + borderSide: BorderSide( + color: inactive, + ), + ), + ), + ); + } + + void updateColors(Color active, Color inactive) { + selected = active; + this.inactive = inactive; + } +} diff --git a/pubspec.yaml b/pubspec.yaml index c7b0b23..0498ae6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: libacflutter description: "A new Flutter package project." -version: 1.0.020325+1224 +version: 1.0.031525+0222 homepage: https://zontreck.com publish_to: https://git.zontreck.com/api/packages/Packages/pub