From 525e980e20e2b2dc728cccf4c556f6a08624eca8 Mon Sep 17 00:00:00 2001 From: Gaspard Merten Date: Sat, 23 Jan 2021 11:57:52 +0100 Subject: [PATCH] Fixing critical issue --- CHANGELOG.md | 12 ++++ README.md | 2 +- example/lib/main.dart | 137 ++++++++++++++++++++---------------------- lib/date_field.dart | 9 ++- pubspec.yaml | 6 +- 5 files changed, 88 insertions(+), 78 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aca7476..385e212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,3 +70,15 @@ Breaking change: ##1.0.1 * Removing the ripple effect + +##1.0.2 + +* Improving package description + +##1.0.3 + +* Improving package description + +##1.0.4 + +* Fixing critical issue diff --git a/README.md b/README.md index aaa7b94..26c56e3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency: ```yaml dependencies: ... - date_field: ^1.0.1 + date_field: ^1.0.4 ``` In your library add the following import: diff --git a/example/lib/main.dart b/example/lib/main.dart index de5d8d7..e4bf540 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -12,10 +12,8 @@ class MyApp extends StatelessWidget { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( - inputDecorationTheme: const InputDecorationTheme( - border: OutlineInputBorder() - ), - + inputDecorationTheme: + const InputDecorationTheme(border: OutlineInputBorder()), primarySwatch: Colors.blue, ), home: MyHomePage(), @@ -23,7 +21,6 @@ class MyApp extends StatelessWidget { } } - class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => _MyHomePageState(); @@ -34,74 +31,72 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - return Scaffold( body: Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const FlutterLogo(size: 100), - const SizedBox(height: 20), - const Text('DateField package showcase'), - const Padding( - padding: EdgeInsets.symmetric(vertical: 20.0), - child: Text('DateTimeField'), - ), - DateTimeField( - decoration: const InputDecoration( - hintText: 'Please select your birthday date and time' - ), - selectedDate: selectedDate, - onDateSelected: (DateTime value) { - setState(() { - selectedDate = value; - }); - } - ), - const Padding( - padding: EdgeInsets.symmetric(vertical: 20.0), - child: Text('DateTimeFormField'), - ), - Form( - child: Column( - children: [ - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'My Super Date Time Field', - ), - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - const SizedBox(height: 50), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'Only time', - ), - mode: DateTimeFieldPickerMode.time, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - ], - ), - ), - ], + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const FlutterLogo(size: 100), + const SizedBox(height: 20), + const Text('DateField package showcase'), + const Padding( + padding: EdgeInsets.symmetric(vertical: 20.0), + child: Text('DateTimeField'), ), - ) - ); + DateTimeField( + decoration: const InputDecoration( + hintText: 'Please select your birthday date and time'), + selectedDate: selectedDate, + onDateSelected: (DateTime value) { + setState(() { + selectedDate = value; + }); + }), + const Padding( + padding: EdgeInsets.symmetric(vertical: 20.0), + child: Text('DateTimeFormField'), + ), + Form( + child: Column( + children: [ + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.event_note), + labelText: 'My Super Date Time Field', + ), + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + const SizedBox(height: 50), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.event_note), + labelText: 'Only time', + ), + mode: DateTimeFieldPickerMode.time, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + ], + ), + ), + ], + ), + )); } } diff --git a/lib/date_field.dart b/lib/date_field.dart index 7d1bff9..b1e2b02 100644 --- a/lib/date_field.dart +++ b/lib/date_field.dart @@ -312,9 +312,12 @@ class _InputDropdown extends StatelessWidget { suffixIcon: const Icon(Icons.arrow_drop_down), ).applyDefaults(Theme.of(context).inputDecorationTheme); - return InputDecorator( - decoration: effectiveDecoration, - child: Text(text, style: textStyle), + return GestureDetector( + onTap: onPressed, + child: InputDecorator( + decoration: effectiveDecoration, + child: Text(text, style: textStyle), + ), ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 287b806..96a7047 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: date_field -description: A widget in the form of a field that lets people enter choose a date/time/date and time via a date/time picker dialog. -version: 1.0.1 +description: A widget in the form of a field that lets people enter choose a date/time/date and time via a date/time picker dialog. You can specify a custom input decoration, a custom date display. Uses DateTime. +version: 1.0.4 homepage: 'https://github.com/GaspardMerten/date_field' environment: @@ -10,5 +10,5 @@ dependencies: flutter: sdk: flutter - intl: ">=0.2.7 <2.0.0" + intl: ">=0.2.7 <5.0.0"