Skip to content

Commit 380e06e

Browse files
committed
refactor: modified themes and colors, moved them into app_ui
1 parent 69e0738 commit 380e06e

File tree

25 files changed

+238
-241
lines changed

25 files changed

+238
-241
lines changed

lib/app/view/app.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import 'package:provider/provider.dart';
2020

2121
class App extends StatelessWidget {
2222
const App({
23-
super.key,
2423
required AuthenticationRepository authenticationRepository,
2524
required CharacterRepository characterRepository,
2625
required ComicRepository comicRepository,
2726
required CacheManager cacheManager,
27+
super.key,
2828
}) : _authenticationRepository = authenticationRepository,
2929
_characterRepository = characterRepository,
3030
_comicRepository = comicRepository,
@@ -74,8 +74,8 @@ class AppView extends StatelessWidget {
7474
Widget build(BuildContext context) {
7575
return MaterialApp(
7676
debugShowCheckedModeBanner: false,
77-
theme: lightThemeData(),
78-
darkTheme: darkThemeData(),
77+
theme: AppTheme().themeData,
78+
darkTheme: AppDarkTheme().themeData,
7979
localizationsDelegates: const [
8080
AppLocalizations.delegate,
8181
GlobalMaterialLocalizations.delegate,

lib/character_detail/view/character_detail_page.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class _CharacterSliverApp extends StatelessWidget {
132132
visible: !isShrink,
133133
child: DecoratedBox(
134134
decoration: BoxDecoration(
135-
color: blue.withAlpha(200),
135+
color: AppColors.blue.withAlpha(200),
136136
backgroundBlendMode: BlendMode.darken,
137137
),
138138
child: Text(character.name),
@@ -168,12 +168,12 @@ class _DescriptionView extends StatelessWidget {
168168
const SizedBox(height: 20),
169169
Text(
170170
l10n.description,
171-
style: theme.textTheme.headline1,
171+
style: theme.textTheme.displayLarge,
172172
),
173173
const SizedBox(height: 10),
174174
Text(
175175
character.description,
176-
style: theme.textTheme.bodyText1,
176+
style: theme.textTheme.bodyLarge,
177177
),
178178
],
179179
);
@@ -203,7 +203,7 @@ class _LinksView extends StatelessWidget {
203203
const SizedBox(height: 20),
204204
Text(
205205
l10n.links,
206-
style: theme.textTheme.headline2,
206+
style: theme.textTheme.displayMedium,
207207
),
208208
const SizedBox(height: 10),
209209
],
@@ -250,14 +250,14 @@ class TextLink extends StatelessWidget {
250250
children: [
251251
const Icon(
252252
Icons.link,
253-
color: red,
253+
color: AppColors.red,
254254
),
255255
const SizedBox(width: 10),
256256
Text(
257257
type,
258-
style: theme.textTheme.bodyText1!.copyWith(
258+
style: theme.textTheme.bodyLarge!.copyWith(
259259
fontSize: 24,
260-
color: red,
260+
color: AppColors.red,
261261
),
262262
),
263263
],
@@ -281,12 +281,12 @@ class _DatesView extends StatelessWidget {
281281
children: [
282282
Text(
283283
l10n.last_modified,
284-
style: theme.textTheme.subtitle1,
284+
style: theme.textTheme.titleMedium,
285285
),
286286
const SizedBox(width: 10),
287287
Text(
288288
character.modified,
289-
style: theme.textTheme.subtitle1,
289+
style: theme.textTheme.titleMedium,
290290
),
291291
],
292292
);

lib/characters/view/characters_page.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:character_repository/character_repository.dart';
33
import 'package:domain/domain.dart';
44
import 'package:flutter/material.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
6-
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
76
import 'package:marvel/character_detail/character_detail.dart';
87
import 'package:marvel/characters/characters.dart';
98
import 'package:marvel/l10n/l10n.dart';
@@ -158,7 +157,7 @@ class _CharactersListView extends StatelessWidget {
158157
},
159158
separatorBuilder: (context, index) {
160159
return Container(
161-
color: red,
160+
color: AppColors.red,
162161
height: 1.5,
163162
);
164163
},
@@ -182,15 +181,15 @@ class CharacterElement extends StatelessWidget {
182181
final theme = Theme.of(context);
183182

184183
return Material(
185-
color: index.isEven ? lightGrey : grey,
184+
color: index.isEven ? AppColors.lightGrey : AppColors.grey,
186185
child: InkWell(
187186
onTap: () {
188187
Navigator.of(context).push<void>(
189188
CharacterDetailPage.page(character),
190189
);
191190
},
192-
splashColor: blue,
193-
highlightColor: lightBlue,
191+
splashColor: AppColors.blue,
192+
highlightColor: AppColors.lightBlue,
194193
child: SizedBox(
195194
height: 150,
196195
child: Stack(
@@ -205,12 +204,12 @@ class CharacterElement extends StatelessWidget {
205204
right: 0,
206205
bottom: 0,
207206
child: Container(
208-
color: blue.withOpacity(0.4),
207+
color: AppColors.blue.withOpacity(0.4),
209208
alignment: Alignment.bottomCenter,
210209
padding: const EdgeInsets.all(5),
211210
child: Text(
212211
character.name,
213-
style: theme.textTheme.bodyText2,
212+
style: theme.textTheme.bodyMedium,
214213
),
215214
),
216215
),

lib/comic_detail/view/comic_detail_page.dart

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import 'package:flutter/material.dart';
44
import 'package:intl/intl.dart';
55
import 'package:marvel/l10n/l10n.dart';
66
import 'package:marvel/webview/webview_page.dart';
7-
import 'package:provider/provider.dart';
87

98
class ComicDetailPage extends StatefulWidget {
10-
const ComicDetailPage({super.key, required this.comic});
9+
const ComicDetailPage({
10+
required this.comic,
11+
super.key,
12+
});
1113

1214
static PageRoute page(Comic comic) => MaterialPageRoute<void>(
1315
builder: (context) => ComicDetailPage(
@@ -139,7 +141,7 @@ class _ComicSliverApp extends StatelessWidget {
139141
visible: !isShrink,
140142
child: DecoratedBox(
141143
decoration: BoxDecoration(
142-
color: blue.withAlpha(200),
144+
color: AppColors.blue.withAlpha(200),
143145
backgroundBlendMode: BlendMode.darken,
144146
),
145147
child: Text(comic.title),
@@ -148,7 +150,6 @@ class _ComicSliverApp extends StatelessWidget {
148150
titlePadding: const EdgeInsets.only(left: 40, bottom: 15, right: 20),
149151
background: MarvelNetworkImage(
150152
imageUrl: comic.thumbnail.comicDetailPreview,
151-
// cacheManager: context.read<CacheManager>(),
152153
),
153154
),
154155
);
@@ -176,12 +177,12 @@ class _DescriptionView extends StatelessWidget {
176177
const SizedBox(height: 20),
177178
Text(
178179
l10n.description,
179-
style: theme.textTheme.headline1,
180+
style: theme.textTheme.displayLarge,
180181
),
181182
const SizedBox(height: 10),
182183
Text(
183184
comic.description,
184-
style: theme.textTheme.bodyText1,
185+
style: theme.textTheme.bodyLarge,
185186
),
186187
],
187188
);
@@ -211,7 +212,7 @@ class _LinksView extends StatelessWidget {
211212
const SizedBox(height: 20),
212213
Text(
213214
l10n.links,
214-
style: theme.textTheme.headline2,
215+
style: theme.textTheme.displayMedium,
215216
),
216217
const SizedBox(height: 10),
217218
],
@@ -238,10 +239,10 @@ class _LinksView extends StatelessWidget {
238239
@visibleForTesting
239240
class TextLink extends StatelessWidget {
240241
const TextLink({
241-
super.key,
242242
required this.url,
243243
required this.type,
244244
required this.onTap,
245+
super.key,
245246
});
246247

247248
final String url;
@@ -258,14 +259,14 @@ class TextLink extends StatelessWidget {
258259
children: [
259260
const Icon(
260261
Icons.link,
261-
color: red,
262+
color: AppColors.red,
262263
),
263264
const SizedBox(width: 10),
264265
Text(
265266
type,
266-
style: theme.textTheme.bodyText1!.copyWith(
267+
style: theme.textTheme.bodyLarge!.copyWith(
267268
fontSize: 24,
268-
color: red,
269+
color: AppColors.red,
269270
),
270271
),
271272
],
@@ -297,7 +298,7 @@ class _PricesView extends StatelessWidget {
297298
const SizedBox(height: 20),
298299
Text(
299300
l10n.prices,
300-
style: theme.textTheme.headline2,
301+
style: theme.textTheme.displayMedium,
301302
),
302303
const SizedBox(height: 10),
303304
],
@@ -307,7 +308,7 @@ class _PricesView extends StatelessWidget {
307308
(view as Column).children.add(
308309
Text(
309310
element.toCurrency(context),
310-
style: theme.textTheme.bodyText1,
311+
style: theme.textTheme.bodyLarge,
311312
),
312313
);
313314
}
@@ -339,7 +340,7 @@ class _ImagesView extends StatelessWidget {
339340
const SizedBox(height: 20),
340341
Text(
341342
l10n.images,
342-
style: theme.textTheme.headline2,
343+
style: theme.textTheme.displayMedium,
343344
),
344345
const SizedBox(height: 10),
345346
SizedBox(
@@ -383,12 +384,12 @@ class _DatesView extends StatelessWidget {
383384
children: [
384385
Text(
385386
l10n.last_modified,
386-
style: theme.textTheme.subtitle1,
387+
style: theme.textTheme.titleMedium,
387388
),
388389
const SizedBox(width: 10),
389390
Text(
390391
comic.modified,
391-
style: theme.textTheme.subtitle1,
392+
style: theme.textTheme.titleMedium,
392393
),
393394
],
394395
);

lib/comics/view/comics_page.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,15 @@ class ComicElement extends StatelessWidget {
153153
final theme = Theme.of(context);
154154

155155
return Material(
156-
color: index.isEven ? lightGrey : grey,
156+
color: index.isEven ? AppColors.lightGrey : AppColors.grey,
157157
child: InkWell(
158158
onTap: () {
159159
Navigator.of(context).push<void>(
160160
ComicDetailPage.page(comic),
161161
);
162162
},
163-
splashColor: blue,
164-
highlightColor: lightBlue,
163+
splashColor: AppColors.blue,
164+
highlightColor: AppColors.lightBlue,
165165
child: SizedBox(
166166
height: 150,
167167
child: Stack(
@@ -176,12 +176,12 @@ class ComicElement extends StatelessWidget {
176176
right: 0,
177177
bottom: 0,
178178
child: Container(
179-
color: blue.withOpacity(0.4),
179+
color: AppColors.blue.withOpacity(0.4),
180180
alignment: Alignment.bottomCenter,
181181
padding: const EdgeInsets.all(5),
182182
child: Text(
183183
comic.title,
184-
style: theme.textTheme.bodyText2,
184+
style: theme.textTheme.bodyMedium,
185185
),
186186
),
187187
),

lib/home/view/home_page.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,27 @@ class HomeView extends StatelessWidget {
6161
HeroBottomNavigationItem(
6262
label: l10n.menu_characters,
6363
image: MarvelIcons.menu.captainAmerica,
64-
color: state == 0 ? Section.characters.color : lightGrey,
64+
color: state == 0
65+
? Section.characters.color
66+
: AppColors.lightGrey,
6567
),
6668
HeroBottomNavigationItem(
6769
label: l10n.menu_comics,
6870
image: MarvelIcons.menu.hulk,
69-
color: state == 1 ? Section.comics.color : lightGrey,
71+
color:
72+
state == 1 ? Section.comics.color : AppColors.lightGrey,
7073
),
7174
HeroBottomNavigationItem(
7275
label: l10n.menu_series,
7376
image: MarvelIcons.menu.thor,
74-
color: state == 2 ? Section.series.color : lightGrey,
77+
color:
78+
state == 2 ? Section.series.color : AppColors.lightGrey,
7579
),
7680
HeroBottomNavigationItem(
7781
label: l10n.menu_stories,
7882
image: MarvelIcons.menu.ironMan,
79-
color: state == 3 ? Section.stories.color : lightGrey,
83+
color:
84+
state == 3 ? Section.stories.color : AppColors.lightGrey,
8085
),
8186
],
8287
),

lib/home/widgets/heroes_bottom_navigation_bar.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ class HeroesBottomNavigationBar extends StatelessWidget {
2222
children: [
2323
Container(
2424
height: 2,
25-
color: red,
25+
color: AppColors.red,
2626
),
2727
Theme(
2828
data: theme.copyWith(canvasColor: theme.primaryColor),
2929
child: BlocBuilder<SectionCubit, int>(
3030
builder: (context, state) {
3131
return BottomNavigationBar(
32-
unselectedItemColor: lightGrey,
32+
unselectedItemColor: AppColors.lightGrey,
3333
selectedItemColor: items[state].color,
34-
selectedLabelStyle: const TextStyle(fontFamily: MarvelFont),
3534
iconSize: 32,
3635
selectedFontSize: 12,
3736
type: BottomNavigationBarType.fixed,

lib/login/view/login_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class _AuthenticatedLoginForm extends StatelessWidget {
144144
const SizedBox(height: 80),
145145
if (state.status.isLoading)
146146
const CircularProgressIndicator(
147-
color: red,
147+
color: AppColors.red,
148148
),
149149
],
150150
);
@@ -188,7 +188,7 @@ class _UnauthenticatedLoginForm extends StatelessWidget {
188188
const SizedBox(height: 80),
189189
if (state.status.isLoading)
190190
const CircularProgressIndicator(
191-
color: red,
191+
color: AppColors.red,
192192
),
193193
],
194194
);

0 commit comments

Comments
 (0)