Skip to content

Commit 71278e7

Browse files
Merge pull request #133 from icapps/feature/format
Run formatter
2 parents 2908c35 + e527972 commit 71278e7

62 files changed

Lines changed: 1584 additions & 1272 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

example/lib/main.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ class MyApp extends StatelessWidget {
3131
GlobalMaterialLocalizations.delegate,
3232
GlobalWidgetsLocalizations.delegate,
3333
],
34-
theme: ThemeData(
35-
primarySwatch: Colors.blue,
36-
),
34+
theme: ThemeData(primarySwatch: Colors.blue),
3735
home: MyHomePage(),
3836
routes: {
3937
'touch': (context) => TouchScreen(),
@@ -47,16 +45,12 @@ class MyApp extends StatelessWidget {
4745
}
4846

4947
class MyHomePage extends StatelessWidget {
50-
MyHomePage({
51-
super.key,
52-
});
48+
MyHomePage({super.key});
5349

5450
@override
5551
Widget build(BuildContext context) {
5652
return Scaffold(
57-
appBar: AppBar(
58-
title: Text('Flutter Demo Home Page'),
59-
),
53+
appBar: AppBar(title: Text('Flutter Demo Home Page')),
6054
body: Center(
6155
child: Column(
6256
mainAxisAlignment: MainAxisAlignment.center,

example/lib/screen/counter_screen.dart

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,17 @@ class CounterScreen extends StatelessWidget {
1111
create: () => CounterViewModel(),
1212
childBuilderWithViewModel: (context, viewModel, theme, localization) =>
1313
Scaffold(
14-
appBar: AppBar(
15-
title: Text('Counter'),
16-
),
14+
appBar: AppBar(title: Text('Counter')),
1715
body: Center(
1816
child: Column(
1917
mainAxisAlignment: MainAxisAlignment.center,
2018
children: <Widget>[
21-
Text(
22-
'You have pushed the button this many times:',
23-
),
19+
Text('You have pushed the button this many times:'),
2420
Text(
2521
'${viewModel.current}',
26-
style: Theme.of(context)
27-
.textTheme
28-
.headlineMedium!
29-
.copyWith(color: theme.baseColor),
22+
style: Theme.of(context).textTheme.headlineMedium!.copyWith(
23+
color: theme.baseColor,
24+
),
3025
),
3126
],
3227
),

example/lib/screen/logger_screen.dart

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,21 @@ class LoggerScreen extends StatelessWidget {
1111
create: () => LoggerViewModel()..init(),
1212
childBuilderWithViewModel: (context, viewModel, theme, localization) =>
1313
Scaffold(
14-
appBar: AppBar(
15-
title: Text('Logger test'),
16-
),
14+
appBar: AppBar(title: Text('Logger test')),
1715
body: Center(
1816
child: Column(
1917
mainAxisAlignment: MainAxisAlignment.center,
2018
children: <Widget>[
2119
Padding(
2220
padding: EdgeInsets.symmetric(horizontal: 32),
23-
child: Text(
24-
'Log: ${viewModel.logLine}',
25-
),
21+
child: Text('Log: ${viewModel.logLine}'),
2622
),
2723
const SizedBox(height: 16),
2824
Text(
2925
'${viewModel.current}',
30-
style: Theme.of(context)
31-
.textTheme
32-
.headlineMedium!
33-
.copyWith(color: theme.baseColor),
26+
style: Theme.of(context).textTheme.headlineMedium!.copyWith(
27+
color: theme.baseColor,
28+
),
3429
),
3530
],
3631
),

example/lib/screen/stream_builder_test_screen.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ class StreamBuilderTestScreen extends StatelessWidget {
1111
create: () => StreamTestViewModel()..init(),
1212
childBuilderWithViewModel: (context, viewModel, theme, localization) =>
1313
Scaffold(
14-
appBar: AppBar(
15-
title: Text('Counter'),
16-
),
14+
appBar: AppBar(title: Text('Counter')),
1715
body: Center(
1816
child: Column(
1917
mainAxisAlignment: MainAxisAlignment.center,
2018
children: <Widget>[
21-
Text(
22-
'You have pushed the button this many times:',
23-
),
19+
Text('You have pushed the button this many times:'),
2420
StreamBuilder(
2521
stream: viewModel.counterStream,
2622
builder: (context, snapshot) => Text(
@@ -34,7 +30,7 @@ class StreamBuilderTestScreen extends StatelessWidget {
3430
TextButton(
3531
onPressed: viewModel.addStream,
3632
child: Text('Add stream'),
37-
)
33+
),
3834
],
3935
),
4036
),

example/lib/screen/stream_test_screen.dart

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,22 @@ class StreamTestScreen extends StatelessWidget {
1111
create: () => StreamTestViewModel()..init(),
1212
childBuilderWithViewModel: (context, viewModel, theme, localization) =>
1313
Scaffold(
14-
appBar: AppBar(
15-
title: Text('Counter'),
16-
),
14+
appBar: AppBar(title: Text('Counter')),
1715
body: Center(
1816
child: Column(
1917
mainAxisAlignment: MainAxisAlignment.center,
2018
children: <Widget>[
21-
Text(
22-
'You have pushed the button this many times:',
23-
),
19+
Text('You have pushed the button this many times:'),
2420
Text(
2521
'${viewModel.current}',
26-
style: Theme.of(context)
27-
.textTheme
28-
.headlineMedium!
29-
.copyWith(color: theme.baseColor),
22+
style: Theme.of(context).textTheme.headlineMedium!.copyWith(
23+
color: theme.baseColor,
24+
),
3025
),
3126
TextButton(
3227
onPressed: viewModel.addStream,
3328
child: Text('Add stream'),
34-
)
29+
),
3530
],
3631
),
3732
),

example/lib/screen/touch_screen.dart

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ class TouchScreen extends StatefulWidget {
1010

1111
class _TouchScreenState extends State<TouchScreen> {
1212
Map<Color, int> _counters = Colors.primaries.asMap().map(
13-
(key, value) => MapEntry(
14-
value,
15-
0,
16-
),
13+
(key, value) => MapEntry(value, 0),
1714
);
1815

1916
bool forceAndroid = false;
@@ -29,9 +26,7 @@ class _TouchScreenState extends State<TouchScreen> {
2926
@override
3027
Widget build(BuildContext context) {
3128
return Scaffold(
32-
appBar: AppBar(
33-
title: Text('Touch'),
34-
),
29+
appBar: AppBar(title: Text('Touch')),
3530
body: Center(
3631
child: ListView(
3732
children: [
@@ -67,33 +62,24 @@ class _TouchScreenState extends State<TouchScreen> {
6762
Text('Is Dark'),
6863
],
6964
),
70-
Center(
71-
child: Text(
72-
'You have pushed the buttons this many times:',
73-
),
74-
),
75-
..._counters.entries.map(
76-
(entry) {
77-
final color = entry.key;
78-
final count = entry.value;
79-
return Center(
80-
child: TouchFeedBack(
81-
onTapped: () {},
82-
child: Text(
83-
'0x${color.toARGB32().toRadixString(16).padLeft(8, '0')}: $count',
84-
style: Theme.of(context)
85-
.textTheme
86-
.headlineMedium!
87-
.copyWith(color: color),
88-
),
65+
Center(child: Text('You have pushed the buttons this many times:')),
66+
..._counters.entries.map((entry) {
67+
final color = entry.key;
68+
final count = entry.value;
69+
return Center(
70+
child: TouchFeedBack(
71+
onTapped: () {},
72+
child: Text(
73+
'0x${color.toARGB32().toRadixString(16).padLeft(8, '0')}: $count',
74+
style: Theme.of(
75+
context,
76+
).textTheme.headlineMedium!.copyWith(color: color),
8977
),
90-
);
91-
},
92-
),
78+
),
79+
);
80+
}),
9381
const SizedBox(height: 16),
94-
Center(
95-
child: _createButtons(_counters),
96-
),
82+
Center(child: _createButtons(_counters)),
9783
const SizedBox(height: 16),
9884
Padding(
9985
padding: EdgeInsets.all(16),
@@ -103,19 +89,13 @@ class _TouchScreenState extends State<TouchScreen> {
10389
TouchFeedBack(
10490
forcePlatform: _forcePlatform,
10591
onTapped: () {},
106-
child: Icon(
107-
Icons.plus_one,
108-
size: 32,
109-
),
92+
child: Icon(Icons.plus_one, size: 32),
11093
),
11194
const SizedBox(width: 8),
11295
TouchFeedBack(
11396
forcePlatform: _forcePlatform,
11497
onTapped: () {},
115-
child: Text(
116-
'Tap me',
117-
style: TextStyle(fontSize: 20),
118-
),
98+
child: Text('Tap me', style: TextStyle(fontSize: 20)),
11999
),
120100
const SizedBox(width: 8),
121101
],
@@ -160,12 +140,11 @@ class _TouchScreenState extends State<TouchScreen> {
160140
color: counters.entries.first.key,
161141
padding: const EdgeInsets.all(16),
162142
child: _createButtons(
163-
counters.entries.skip(1).toList().asMap().map(
164-
(key, value) => MapEntry(
165-
value.key,
166-
value.value,
167-
),
168-
),
143+
counters.entries
144+
.skip(1)
145+
.toList()
146+
.asMap()
147+
.map((key, value) => MapEntry(value.key, value.value)),
169148
),
170149
),
171150
);

example/lib/util/locale/localization.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ class Localization {
1313
static Localization of(BuildContext context) =>
1414
Localizations.of<Localization>(context, Localization)!;
1515

16-
static Future<Localization> load(Locale locale,
17-
{bool showLocalizationKeys = false}) async {
16+
static Future<Localization> load(
17+
Locale locale, {
18+
bool showLocalizationKeys = false,
19+
}) async {
1820
final localizations = Localization();
1921
if (showLocalizationKeys) {
2022
return localizations;
2123
}
22-
final jsonContent = await rootBundle
23-
.loadString('assets/locale/${locale.languageCode}.json');
24+
final jsonContent = await rootBundle.loadString(
25+
'assets/locale/${locale.languageCode}.json',
26+
);
2427
localizations._localisedValues =
2528
json.decode(jsonContent) as Map<String, dynamic>; // ignore: avoid_as
2629
return localizations;
@@ -33,8 +36,10 @@ class Localization {
3336
if (args == null || args.isEmpty) return value;
3437
var newValue = value;
3538
// ignore: avoid_annotating_with_dynamic
36-
args.asMap().forEach((index, dynamic arg) =>
37-
newValue = _replaceWith(newValue, arg, index + 1));
39+
args.asMap().forEach(
40+
(index, dynamic arg) =>
41+
newValue = _replaceWith(newValue, arg, index + 1),
42+
);
3843
return newValue;
3944
} catch (e) {
4045
return '⚠$key⚠';

example/lib/util/locale/localization_delegate.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ typedef LocaleFilter = bool Function(String languageCode);
1212
class LocalizationDelegate extends LocalizationsDelegate<Localization> {
1313
static LocaleFilter? localeFilter;
1414
static const defaultLocale = Locale('en');
15-
static const _supportedLanguages = [
16-
'en',
17-
];
15+
static const _supportedLanguages = ['en'];
1816

19-
static const _supportedLocales = [
20-
Locale('en'),
21-
];
17+
static const _supportedLocales = [Locale('en')];
2218

2319
static List<String> get supportedLanguages {
2420
if (localeFilter == null) return _supportedLanguages;
@@ -52,8 +48,10 @@ class LocalizationDelegate extends LocalizationsDelegate<Localization> {
5248
Future<Localization> load(Locale locale) async {
5349
final newActiveLocale = newLocale ?? locale;
5450
activeLocale = newActiveLocale;
55-
return Localization.load(newActiveLocale,
56-
showLocalizationKeys: showLocalizationKeys);
51+
return Localization.load(
52+
newActiveLocale,
53+
showLocalizationKeys: showLocalizationKeys,
54+
);
5755
}
5856

5957
@override

example/lib/viewmodel/stream_test_viewmodel.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import 'package:icapps_architecture/icapps_architecture.dart';
22

33
class StreamTestViewModel with ChangeNotifierEx {
4-
final _counterStream =
5-
StreamControllerWithInitialValue<int>.broadcast(value: 0);
4+
final _counterStream = StreamControllerWithInitialValue<int>.broadcast(
5+
value: 0,
6+
);
67
var _current = 0;
78

89
int get current => _current;

example/lib/widget/provider/provider_widget.dart

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,25 @@ class ProviderWidget<T extends ChangeNotifier>
99
required T Function() create,
1010
Widget? child,
1111
Widget Function(
12-
BuildContext context, AppTheme theme, Localization localization)?
13-
childBuilder,
14-
Widget Function(BuildContext context, T viewModel, AppTheme theme,
15-
Localization localization)?
16-
childBuilderWithViewModel,
12+
BuildContext context,
13+
AppTheme theme,
14+
Localization localization,
15+
)? childBuilder,
16+
Widget Function(
17+
BuildContext context,
18+
T viewModel,
19+
AppTheme theme,
20+
Localization localization,
21+
)? childBuilderWithViewModel,
1722
Widget? consumerChild,
1823
Widget Function(BuildContext context, T viewModel, Widget? child)? consumer,
19-
Widget Function(BuildContext context, T viewModel, Widget? child,
20-
AppTheme theme, Localization localization)?
21-
consumerWithThemeAndLocalization,
24+
Widget Function(
25+
BuildContext context,
26+
T viewModel,
27+
Widget? child,
28+
AppTheme theme,
29+
Localization localization,
30+
)? consumerWithThemeAndLocalization,
2231
bool lazy = true,
2332
}) : super(
2433
create: create,

0 commit comments

Comments
 (0)