Skip to content

Commit

Permalink
run dart format on project
Browse files Browse the repository at this point in the history
  • Loading branch information
stMerlHin committed Jul 11, 2023
1 parent 5453636 commit 8b3c794
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 32 deletions.
2 changes: 1 addition & 1 deletion example/lib/widgets/widget_text_title1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class WidgetTextTitle1 extends StatelessWidget {
),
);
}
}
}
4 changes: 2 additions & 2 deletions lib/src/selectors/date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class MacosDatePicker extends StatefulWidget {

/// Allows for changing the order of day headers in the graphical Date Picker
/// to Mo, Tu, We, Th, Fr, Sa, Su.
///
///
/// This is useful for internationalization purposes, as many countries begin their weeks on Mondays.
///
///
/// Defaults to `false`.
final bool? startWeekOnMonday;

Expand Down
5 changes: 2 additions & 3 deletions lib/src/theme/macos_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ class MacosThemeData with Diagnosticable {
);
pushButtonTheme ??= PushButtonThemeData(
color: primaryColor,
secondaryColor: isDark
? const Color.fromRGBO(110, 109, 112, 1.0)
: MacosColors.white,
secondaryColor:
isDark ? const Color.fromRGBO(110, 109, 112, 1.0) : MacosColors.white,
disabledColor: isDark
? const Color.fromRGBO(255, 255, 255, 0.1)
: const Color.fromRGBO(244, 245, 245, 1.0),
Expand Down
56 changes: 30 additions & 26 deletions test/selectors/date_picker_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,32 @@ void main() {

testWidgets(
'Textual MacosDatePicker renders the date with respect to "dateFormat" property',
(tester) async {
(tester) async {
renderWidget(String dateFormat) => MacosApp(
home: MacosWindow(
disableWallpaperTinting: true,
child: MacosScaffold(
children: [
ContentArea(
builder: (context, _) {
return Center(
child: MacosDatePicker(
initialDate: DateTime.parse('2023-04-01'),
onDateChanged: (date) {},
dateFormat: dateFormat,
style: DatePickerStyle.textual,
),
);
},
home: MacosWindow(
disableWallpaperTinting: true,
child: MacosScaffold(
children: [
ContentArea(
builder: (context, _) {
return Center(
child: MacosDatePicker(
initialDate: DateTime.parse('2023-04-01'),
onDateChanged: (date) {},
dateFormat: dateFormat,
style: DatePickerStyle.textual,
),
);
},
),
],
),
],
),
),
);
),
);

getNthTextFromWidget(int index) => (find.byType(Text).at(index).evaluate().first.widget as Text).data as String;
getNthTextFromWidget(int index) =>
(find.byType(Text).at(index).evaluate().first.widget as Text).data
as String;

await tester.pumpWidget(renderWidget('dd.mm.yyyy'));
String firstDateElement = getNthTextFromWidget(0);
Expand Down Expand Up @@ -363,7 +365,7 @@ void main() {

testWidgets(
'Graphical MacosDatePicker renders abbreviations based on "weekdayAbbreviations" and "monthAbbreviations" properties',
(tester) async {
(tester) async {
await tester.pumpWidget(
MacosApp(
home: MacosWindow(
Expand Down Expand Up @@ -424,7 +426,7 @@ void main() {

testWidgets(
'Graphical MacosDatePicker with "startWeekOnMonday" set to true shows Monday as the first day of the week',
(tester) async {
(tester) async {
await tester.pumpWidget(
MacosApp(
home: MacosWindow(
Expand Down Expand Up @@ -453,7 +455,8 @@ void main() {
matching: find.byType(Text),
);
final firstWeekday = dayHeaders.first;
final firstWeekdayText = (firstWeekday.evaluate().first.widget as Text).data;
final firstWeekdayText =
(firstWeekday.evaluate().first.widget as Text).data;
await tester.pumpAndSettle();

expect(firstWeekdayText, 'Mo');
Expand All @@ -474,7 +477,7 @@ void main() {
// TODO: remove this once the issue is fixed and test starts failing
testWidgets(
'Graphical MacosDatePicker still needs "startWeekOnMonday" to show Monday as the first day of the week, even when the locale is set to something other than "en_US"',
(tester) async {
(tester) async {
await tester.pumpWidget(
MacosApp(
supportedLocales: const [
Expand Down Expand Up @@ -506,7 +509,8 @@ void main() {
matching: find.byType(Text),
);
final firstWeekday = dayHeaders.first;
final firstWeekdayText = (firstWeekday.evaluate().first.widget as Text).data;
final firstWeekdayText =
(firstWeekday.evaluate().first.widget as Text).data;
await tester.pumpAndSettle();

// The result will be 'Tu' if the fix is no longer needed and can be removed
Expand Down

0 comments on commit 8b3c794

Please sign in to comment.