Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -20,13 +20,9 @@ class DatePickerApp extends StatelessWidget {
|
||||
todayForegroundColor: const WidgetStatePropertyAll<Color>(Colors.black),
|
||||
todayBorder: const BorderSide(width: 2),
|
||||
dayShape: WidgetStatePropertyAll<OutlinedBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
),
|
||||
),
|
||||
home: const DatePickerExample(),
|
||||
|
||||
@@ -37,21 +37,19 @@ class _DatePickerExampleState extends State<DatePickerExample> with RestorationM
|
||||
String? get restorationId => widget.restorationId;
|
||||
|
||||
final RestorableDateTime _selectedDate = RestorableDateTime(DateTime(2021, 7, 25));
|
||||
late final RestorableRouteFuture<DateTime?> _restorableDatePickerRouteFuture = RestorableRouteFuture<DateTime?>(
|
||||
onComplete: _selectDate,
|
||||
onPresent: (NavigatorState navigator, Object? arguments) {
|
||||
return navigator.restorablePush(
|
||||
_datePickerRoute,
|
||||
arguments: _selectedDate.value.millisecondsSinceEpoch,
|
||||
late final RestorableRouteFuture<DateTime?> _restorableDatePickerRouteFuture =
|
||||
RestorableRouteFuture<DateTime?>(
|
||||
onComplete: _selectDate,
|
||||
onPresent: (NavigatorState navigator, Object? arguments) {
|
||||
return navigator.restorablePush(
|
||||
_datePickerRoute,
|
||||
arguments: _selectedDate.value.millisecondsSinceEpoch,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
static Route<DateTime> _datePickerRoute(
|
||||
BuildContext context,
|
||||
Object? arguments,
|
||||
) {
|
||||
static Route<DateTime> _datePickerRoute(BuildContext context, Object? arguments) {
|
||||
return DialogRoute<DateTime>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@@ -76,10 +74,13 @@ class _DatePickerExampleState extends State<DatePickerExample> with RestorationM
|
||||
if (newSelectedDate != null) {
|
||||
setState(() {
|
||||
_selectedDate.value = newSelectedDate;
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content:
|
||||
Text('Selected: ${_selectedDate.value.day}/${_selectedDate.value.month}/${_selectedDate.value.year}'),
|
||||
));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Selected: ${_selectedDate.value.day}/${_selectedDate.value.month}/${_selectedDate.value.year}',
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,13 +53,10 @@ class _DatePickerExampleState extends State<DatePickerExample> {
|
||||
children: <Widget>[
|
||||
Text(
|
||||
selectedDate != null
|
||||
? '${selectedDate!.day}/${selectedDate!.month}/${selectedDate!.year}'
|
||||
: 'No date selected',
|
||||
),
|
||||
OutlinedButton(
|
||||
onPressed: _selectDate,
|
||||
child: const Text('Select Date'),
|
||||
? '${selectedDate!.day}/${selectedDate!.month}/${selectedDate!.year}'
|
||||
: 'No date selected',
|
||||
),
|
||||
OutlinedButton(onPressed: _selectDate, child: const Text('Select Date')),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,14 +40,17 @@ class _DatePickerExampleState extends State<DatePickerExample> with RestorationM
|
||||
final RestorableDateTimeN _endDate = RestorableDateTimeN(DateTime(2021, 1, 5));
|
||||
late final RestorableRouteFuture<DateTimeRange?> _restorableDateRangePickerRouteFuture =
|
||||
RestorableRouteFuture<DateTimeRange?>(
|
||||
onComplete: _selectDateRange,
|
||||
onPresent: (NavigatorState navigator, Object? arguments) {
|
||||
return navigator.restorablePush(_dateRangePickerRoute, arguments: <String, dynamic>{
|
||||
'initialStartDate': _startDate.value?.millisecondsSinceEpoch,
|
||||
'initialEndDate': _endDate.value?.millisecondsSinceEpoch,
|
||||
});
|
||||
},
|
||||
);
|
||||
onComplete: _selectDateRange,
|
||||
onPresent: (NavigatorState navigator, Object? arguments) {
|
||||
return navigator.restorablePush(
|
||||
_dateRangePickerRoute,
|
||||
arguments: <String, dynamic>{
|
||||
'initialStartDate': _startDate.value?.millisecondsSinceEpoch,
|
||||
'initialEndDate': _endDate.value?.millisecondsSinceEpoch,
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
void _selectDateRange(DateTimeRange? newSelectedDate) {
|
||||
if (newSelectedDate != null) {
|
||||
@@ -66,10 +69,7 @@ class _DatePickerExampleState extends State<DatePickerExample> with RestorationM
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
static Route<DateTimeRange?> _dateRangePickerRoute(
|
||||
BuildContext context,
|
||||
Object? arguments,
|
||||
) {
|
||||
static Route<DateTimeRange?> _dateRangePickerRoute(BuildContext context, Object? arguments) {
|
||||
return DialogRoute<DateTimeRange?>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user