Skip to content

Commit

Permalink
flutter format .
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Wei committed Jan 2, 2022
1 parent 92b1845 commit 16fea30
Show file tree
Hide file tree
Showing 57 changed files with 786 additions and 629 deletions.
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ analyzer:

linter:
rules:
avoid_multiple_declarations_per_line: false
prefer_relative_imports: true # https://stackoverflow.com/a/66188522/12421326
always_use_package_imports: false
require_trailing_commas: false
# Rationale: in our app, the codes are for reading on mobile phones, adding
# `this` makes it easier for readers to understand which variables class
# members and which ones are not.
Expand Down
203 changes: 101 additions & 102 deletions lib/my_app_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -918,109 +918,108 @@ const kMyAppRoutesAdvanced = <MyRouteGroup>[
],
),
MyRouteGroup(
groupName: 'Charts',
icon: Icon(Icons.show_chart),
routes: <MyRoute>[
MyRoute(
child: TimeseriesChartExample(),
sourceFilePath: 'lib/routes/charts_time_series_ex.dart',
title: 'Time Series Chart',
links: {
'Demo gallery':
'https://google.github.io/charts/flutter/gallery.html'
},
),
MyRoute(
child: PieChartExample(),
sourceFilePath: 'lib/routes/charts_pie_chart_ex.dart',
title: 'Pie Chart',
links: {
'Demo gallery':
'https://google.github.io/charts/flutter/gallery.html'
},
),
MyRoute(
child: FlLineChartExample(),
sourceFilePath: 'lib/routes/charts_fl_line_chart_ex.dart',
title: 'LineChart with fl_chart',
links: {
'doc':
'https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md'
},
),
MyRoute(
child: FlBarChartExample(),
sourceFilePath: 'lib/routes/charts_fl_bar_chart_ex.dart',
title: 'BarChart with fl_chart',
links: {
'doc':
'https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/bar_chart.md'
},
),
MyRoute(
child: FlPieChartExample(),
sourceFilePath: 'lib/routes/charts_fl_pie_chart_ex.dart',
title: 'PieChart with fl_chart',
links: {
'doc':
'https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/pie_chart.md'
},
),
MyRoute(
child: GraphViewExample(),
sourceFilePath: 'lib/routes/charts_graphview_ex.dart',
title: 'GraphView',
links: {'pub.dev': 'https://pub.dev/packages/graphview'},
),
MyRoute(
child: HeatmapCalendarExample(),
sourceFilePath: 'lib/routes/charts_heatmap_calendar_ex.dart',
title: 'Heatmap Calendar',
links: {'pub.dev': 'https://pub.dev/packages/heatmap_calendar'},
),
MyRoute(
child: RadarChartExample(),
sourceFilePath: 'lib/routes/charts_radar_chart_ex.dart',
title: 'Radar Chart',
links: {'pub.dev': 'https://pub.dev/packages/flutter_radar_chart'},
),
],),
groupName: 'Charts',
icon: Icon(Icons.show_chart),
routes: <MyRoute>[
MyRoute(
child: TimeseriesChartExample(),
sourceFilePath: 'lib/routes/charts_time_series_ex.dart',
title: 'Time Series Chart',
links: {
'Demo gallery': 'https://google.github.io/charts/flutter/gallery.html'
},
),
MyRoute(
child: PieChartExample(),
sourceFilePath: 'lib/routes/charts_pie_chart_ex.dart',
title: 'Pie Chart',
links: {
'Demo gallery': 'https://google.github.io/charts/flutter/gallery.html'
},
),
MyRoute(
child: FlLineChartExample(),
sourceFilePath: 'lib/routes/charts_fl_line_chart_ex.dart',
title: 'LineChart with fl_chart',
links: {
'doc':
'https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md'
},
),
MyRoute(
child: FlBarChartExample(),
sourceFilePath: 'lib/routes/charts_fl_bar_chart_ex.dart',
title: 'BarChart with fl_chart',
links: {
'doc':
'https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/bar_chart.md'
},
),
MyRoute(
child: FlPieChartExample(),
sourceFilePath: 'lib/routes/charts_fl_pie_chart_ex.dart',
title: 'PieChart with fl_chart',
links: {
'doc':
'https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/pie_chart.md'
},
),
MyRoute(
child: GraphViewExample(),
sourceFilePath: 'lib/routes/charts_graphview_ex.dart',
title: 'GraphView',
links: {'pub.dev': 'https://pub.dev/packages/graphview'},
),
MyRoute(
child: HeatmapCalendarExample(),
sourceFilePath: 'lib/routes/charts_heatmap_calendar_ex.dart',
title: 'Heatmap Calendar',
links: {'pub.dev': 'https://pub.dev/packages/heatmap_calendar'},
),
MyRoute(
child: RadarChartExample(),
sourceFilePath: 'lib/routes/charts_radar_chart_ex.dart',
title: 'Radar Chart',
links: {'pub.dev': 'https://pub.dev/packages/flutter_radar_chart'},
),
],
),
MyRouteGroup(
groupName: 'Networking',
icon: Icon(Icons.http),
routes: <MyRoute>[
MyRoute(
child: RestApiFetchExample(),
sourceFilePath: 'lib/routes/networking_rest_api_fetch_ex.dart',
title: 'Fetching data',
links: {
'Cookbook':
'https://flutter.dev/docs/cookbook/networking/fetch-data'
},
),
MyRoute(
child: RestApiSendExample(),
sourceFilePath: 'lib/routes/networking_rest_api_send_ex.dart',
title: 'Sending data',
links: {
'Cookbook': 'https://flutter.dev/docs/cookbook/networking/send-data'
},
),
MyRoute(
child: RestApiHackerNewsExample(),
sourceFilePath: 'lib/routes/networking_hacker_news_ex.dart',
title: 'Hacker News',
description: 'A full REST API example.',
links: {'Hacker News API': 'https://github.com/HackerNews/API'},
),
MyRoute(
child: RestApiGoogleBooksExample(),
sourceFilePath: 'lib/routes/networking_googlebooks_ex.dart',
title: 'Google Books',
description: 'Another REST example using the Google books seach API.',
links: {'Hacker News API': 'https://github.com/HackerNews/API'},
),
],),
groupName: 'Networking',
icon: Icon(Icons.http),
routes: <MyRoute>[
MyRoute(
child: RestApiFetchExample(),
sourceFilePath: 'lib/routes/networking_rest_api_fetch_ex.dart',
title: 'Fetching data',
links: {
'Cookbook': 'https://flutter.dev/docs/cookbook/networking/fetch-data'
},
),
MyRoute(
child: RestApiSendExample(),
sourceFilePath: 'lib/routes/networking_rest_api_send_ex.dart',
title: 'Sending data',
links: {
'Cookbook': 'https://flutter.dev/docs/cookbook/networking/send-data'
},
),
MyRoute(
child: RestApiHackerNewsExample(),
sourceFilePath: 'lib/routes/networking_hacker_news_ex.dart',
title: 'Hacker News',
description: 'A full REST API example.',
links: {'Hacker News API': 'https://github.com/HackerNews/API'},
),
MyRoute(
child: RestApiGoogleBooksExample(),
sourceFilePath: 'lib/routes/networking_googlebooks_ex.dart',
title: 'Google Books',
description: 'Another REST example using the Google books seach API.',
links: {'Hacker News API': 'https://github.com/HackerNews/API'},
),
],
),
MyRouteGroup(
groupName: 'Firebase',
icon: Icon(Icons.cloud),
Expand Down
30 changes: 16 additions & 14 deletions lib/my_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,22 @@ class MyRoute extends StatelessWidget {
subtitle: const Text(APP_VERSION),
),
...MyAboutRoute.kAboutListTiles,
Consumer<MyAppSettings>(builder: (context, MyAppSettings settings, _) {
return ListTile(
onTap: () {},
leading: DayNightSwitcherIcon(
isDarkModeEnabled: settings.isDarkMode,
onStateChanged: (_) {},
),
title: Text('Dark mode: ${settings.isDarkMode ? 'on' : 'off'}'),
trailing: DayNightSwitcher(
isDarkModeEnabled: settings.isDarkMode,
onStateChanged: (bool value) => settings.setDarkMode(value),
),
);
},),
Consumer<MyAppSettings>(
builder: (context, MyAppSettings settings, _) {
return ListTile(
onTap: () {},
leading: DayNightSwitcherIcon(
isDarkModeEnabled: settings.isDarkMode,
onStateChanged: (_) {},
),
title: Text('Dark mode: ${settings.isDarkMode ? 'on' : 'off'}'),
trailing: DayNightSwitcher(
isDarkModeEnabled: settings.isDarkMode,
onStateChanged: (bool value) => settings.setDarkMode(value),
),
);
},
),
],
);
}
Expand Down
8 changes: 5 additions & 3 deletions lib/my_route_search_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class MyRouteSearchDelegate extends SearchDelegate<String> {
];
if (this.query.isNotEmpty) {
suggestions = kAllRoutes
.where((route) =>
route.title.toLowerCase().contains(query.toLowerCase()) ||
route.description.toLowerCase().contains(query.toLowerCase()),)
.where(
(route) =>
route.title.toLowerCase().contains(query.toLowerCase()) ||
route.description.toLowerCase().contains(query.toLowerCase()),
)
.toList();
}
return _buildSuggestionsList(suggestions);
Expand Down
11 changes: 6 additions & 5 deletions lib/routes/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ class MyAboutRoute extends StatelessWidget {
icon: const Icon(Icons.info),
onPressed: () {
showAboutDialog(
context: context,
applicationName: APP_NAME,
applicationVersion: APP_VERSION,
applicationIcon: kAppIcon,
children: <Widget>[const Text(APP_DESCRIPTION)],);
context: context,
applicationName: APP_NAME,
applicationVersion: APP_VERSION,
applicationIcon: kAppIcon,
children: <Widget>[const Text(APP_DESCRIPTION)],
);
},
),
);
Expand Down
6 changes: 5 additions & 1 deletion lib/routes/animation_animated_container_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ class _AnimatedContainerExampleState extends State<AnimatedContainerExample> {
_borderRadius = _rng.nextInt(50).toDouble();
// Generate a random color.
_color = Color.fromRGBO(
_rng.nextInt(256), _rng.nextInt(256), _rng.nextInt(256), 1,);
_rng.nextInt(256),
_rng.nextInt(256),
_rng.nextInt(256),
1,
);
},
),
),
Expand Down
41 changes: 29 additions & 12 deletions lib/routes/animation_animated_radial_menu_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,50 @@ class RadialMenuExample extends StatelessWidget {
title: Text("Animated Radial Menu Example"),
centerTitle: true,
),
body: RadialMenu(children: [
RadialButton(
body: RadialMenu(
children: [
RadialButton(
icon: Icon(Icons.ac_unit),
buttonColor: Colors.teal,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
context,
MaterialPageRoute(builder: (_) => TargetScreen()),
),
),
RadialButton(
icon: Icon(Icons.camera_alt),
buttonColor: Colors.green,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
context,
MaterialPageRoute(builder: (_) => TargetScreen()),
),
),
RadialButton(
icon: Icon(Icons.map),
buttonColor: Colors.orange,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
context,
MaterialPageRoute(builder: (_) => TargetScreen()),
),
),
RadialButton(
icon: Icon(Icons.access_alarm),
buttonColor: Colors.indigo,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
context,
MaterialPageRoute(builder: (_) => TargetScreen()),
),
),
RadialButton(
icon: Icon(Icons.watch),
buttonColor: Colors.pink,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
],),
context,
MaterialPageRoute(builder: (_) => TargetScreen()),
),
),
],
),
);
}
}
Expand Down
Loading

0 comments on commit 16fea30

Please sign in to comment.