Fixing critical issue
This commit is contained in:
parent
aa20bfc716
commit
525e980e20
5 changed files with 88 additions and 78 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -70,3 +70,15 @@ Breaking change:
|
||||||
##1.0.1
|
##1.0.1
|
||||||
|
|
||||||
* Removing the ripple effect
|
* Removing the ripple effect
|
||||||
|
|
||||||
|
##1.0.2
|
||||||
|
|
||||||
|
* Improving package description
|
||||||
|
|
||||||
|
##1.0.3
|
||||||
|
|
||||||
|
* Improving package description
|
||||||
|
|
||||||
|
##1.0.4
|
||||||
|
|
||||||
|
* Fixing critical issue
|
||||||
|
|
|
@ -15,7 +15,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency:
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
...
|
...
|
||||||
date_field: ^1.0.1
|
date_field: ^1.0.4
|
||||||
```
|
```
|
||||||
|
|
||||||
In your library add the following import:
|
In your library add the following import:
|
||||||
|
|
|
@ -12,10 +12,8 @@ class MyApp extends StatelessWidget {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Flutter Demo',
|
title: 'Flutter Demo',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
inputDecorationTheme: const InputDecorationTheme(
|
inputDecorationTheme:
|
||||||
border: OutlineInputBorder()
|
const InputDecorationTheme(border: OutlineInputBorder()),
|
||||||
),
|
|
||||||
|
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
),
|
),
|
||||||
home: MyHomePage(),
|
home: MyHomePage(),
|
||||||
|
@ -23,7 +21,6 @@ class MyApp extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
_MyHomePageState createState() => _MyHomePageState();
|
_MyHomePageState createState() => _MyHomePageState();
|
||||||
|
@ -34,74 +31,72 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.all(20.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const FlutterLogo(size: 100),
|
const FlutterLogo(size: 100),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text('DateField package showcase'),
|
const Text('DateField package showcase'),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 20.0),
|
padding: EdgeInsets.symmetric(vertical: 20.0),
|
||||||
child: Text('DateTimeField'),
|
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);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
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);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,9 +312,12 @@ class _InputDropdown extends StatelessWidget {
|
||||||
suffixIcon: const Icon(Icons.arrow_drop_down),
|
suffixIcon: const Icon(Icons.arrow_drop_down),
|
||||||
).applyDefaults(Theme.of(context).inputDecorationTheme);
|
).applyDefaults(Theme.of(context).inputDecorationTheme);
|
||||||
|
|
||||||
return InputDecorator(
|
return GestureDetector(
|
||||||
decoration: effectiveDecoration,
|
onTap: onPressed,
|
||||||
child: Text(text, style: textStyle),
|
child: InputDecorator(
|
||||||
|
decoration: effectiveDecoration,
|
||||||
|
child: Text(text, style: textStyle),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: date_field
|
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.
|
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.1
|
version: 1.0.4
|
||||||
homepage: 'https://github.com/GaspardMerten/date_field'
|
homepage: 'https://github.com/GaspardMerten/date_field'
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
@ -10,5 +10,5 @@ dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
intl: ">=0.2.7 <2.0.0"
|
intl: ">=0.2.7 <5.0.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue