Skip to content

Commit 23b5b01

Browse files
committed
unify appbar and theming shades
1 parent fd2559a commit 23b5b01

File tree

6 files changed

+68
-16
lines changed

6 files changed

+68
-16
lines changed

lib/core/utilities/theme/theme_mode.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ class ThemeController extends ChangeNotifier {
6464
hintColor: Colors.black38,
6565
cardColor: _lightGrey,
6666
dividerTheme: DividerThemeData(color: _primaryColor.withOpacity(0.1)),
67+
appBarTheme: AppBarTheme(
68+
backgroundColor: _secondaryColor,
69+
foregroundColor: _primaryColor,
70+
surfaceTintColor: Colors.transparent,
71+
elevation: 0,
72+
titleTextStyle: TextStyle(
73+
fontFamily: _fontFamily,
74+
fontSize: 18,
75+
fontWeight: FontWeight.w600,
76+
color: _primaryColor,
77+
),
78+
iconTheme: IconThemeData(color: _primaryColor),
79+
),
6780
colorScheme: ColorScheme.light(
6881
onPrimary: _staticColor,
6982
onSecondary: _lightGrey,
@@ -140,6 +153,19 @@ class ThemeController extends ChangeNotifier {
140153
focusColor: _primaryThemeColor,
141154
hintColor: Colors.white38,
142155
dividerTheme: DividerThemeData(color: _secondaryColor.withOpacity(0.1)),
156+
appBarTheme: AppBarTheme(
157+
backgroundColor: _primaryColor,
158+
foregroundColor: _secondaryColor,
159+
surfaceTintColor: Colors.transparent,
160+
elevation: 0,
161+
titleTextStyle: TextStyle(
162+
fontFamily: _fontFamily,
163+
fontSize: 18,
164+
fontWeight: FontWeight.w600,
165+
color: _secondaryColor,
166+
),
167+
iconTheme: IconThemeData(color: _secondaryColor),
168+
),
143169
colorScheme: ColorScheme.dark(
144170
onPrimary: _staticColor,
145171
onTertiary: _successColor, // color used for success

lib/features/explore/presentation/widgets/thread_type_dropdown.dart

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,34 @@ class ThreadTypeDropdown extends StatelessWidget {
1010

1111
@override
1212
Widget build(BuildContext context) {
13-
return DropdownButton<ThreadFeedType>(
14-
value: value,
15-
onChanged: (v) {
16-
if (v != null) {
17-
onChanged(v);
18-
}
19-
},
13+
final theme = Theme.of(context);
14+
final appBarTheme = theme.appBarTheme;
15+
final Color foregroundColor =
16+
appBarTheme.foregroundColor ?? theme.colorScheme.onSurface;
17+
final TextStyle? titleStyle = appBarTheme.titleTextStyle ??
18+
theme.textTheme.titleMedium?.copyWith(color: foregroundColor);
19+
20+
return DropdownButtonHideUnderline(
21+
child: DropdownButton<ThreadFeedType>(
22+
value: value,
23+
iconEnabledColor: foregroundColor,
24+
iconDisabledColor: foregroundColor,
25+
dropdownColor:
26+
appBarTheme.backgroundColor ?? theme.colorScheme.surface,
27+
style: titleStyle,
28+
onChanged: (v) {
29+
if (v != null) {
30+
onChanged(v);
31+
}
32+
},
2033
items: ThreadFeedType.values
2134
.where((e) => e != ThreadFeedType.all)
2235
.map((e) => DropdownMenuItem(
2336
value: e,
2437
child: Text(Thread.gethreadName(type: e)),
2538
))
2639
.toList(),
40+
),
2741
);
2842
}
2943
}

lib/features/threads/presentation/thread_feed/view/thread_feed_view.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class ThreadFeedView extends StatelessWidget {
2828
return Scaffold(
2929
drawer: const DrawerMenu(),
3030
appBar: AppBar(
31-
backgroundColor: theme.cardColor,
3231
surfaceTintColor: Colors.transparent,
3332
centerTitle: true,
3433
title: DropDownFilter(onChanged: (type) {

lib/features/threads/presentation/thread_feed/widgets/drop_down_filter.dart

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ class _DropDownFilterState extends State<DropDownFilter> {
2929
@override
3030
Widget build(BuildContext context) {
3131
final theme = Theme.of(context);
32+
final appBarTheme = theme.appBarTheme;
33+
final Color dropdownBackground =
34+
appBarTheme.backgroundColor ?? theme.scaffoldBackgroundColor;
35+
final Color foregroundColor =
36+
appBarTheme.foregroundColor ?? theme.colorScheme.onSurface;
37+
final TextStyle titleStyle =
38+
(appBarTheme.titleTextStyle ?? theme.textTheme.titleMedium)?.copyWith(
39+
color: foregroundColor,
40+
) ??
41+
TextStyle(color: foregroundColor);
3242
final controller = context.read<ThreadFeedController>();
3343
final List<ThreadFeedType> types = ThreadFeedType.values.sublist(1);
3444
final String defaultTypeString =
@@ -54,7 +64,7 @@ class _DropDownFilterState extends State<DropDownFilter> {
5464
selectedTextStyle: TextStyle(color: theme.primaryColorDark),
5565
),
5666
dropdownOptions: DropdownOptions(
57-
color: theme.colorScheme.tertiary,
67+
color: dropdownBackground,
5868
),
5969
dropdownTriangleOptions:
6070
const DropdownTriangleOptions(height: 5, width: 0),
@@ -79,11 +89,11 @@ class _DropDownFilterState extends State<DropDownFilter> {
7989
render: ResultRender.all,
8090
openBoxDecoration: BoxDecoration(
8191
borderRadius: const BorderRadius.all(Radius.circular(6)),
82-
color: Colors.transparent,
92+
color: dropdownBackground,
8393
border: Border.all(color: Colors.transparent),
8494
),
8595
boxDecoration: BoxDecoration(
86-
color: Colors.transparent,
96+
color: dropdownBackground,
8797
borderRadius: const BorderRadius.all(Radius.circular(6)),
8898
border: Border.all(color: Colors.transparent),
8999
),
@@ -96,18 +106,22 @@ class _DropDownFilterState extends State<DropDownFilter> {
96106
right: 0,
97107
child: IgnorePointer(
98108
child: Container(
99-
color: theme.cardColor,
109+
color: dropdownBackground,
100110
child: Row(
101111
mainAxisAlignment: MainAxisAlignment.center,
102112
children: [
103113
Text(
104114
Thread.gethreadName(type: controller.threadType),
105115
textAlign: TextAlign.center,
116+
style: titleStyle,
106117
),
107118
const Gap(2),
108-
const Padding(
119+
Padding(
109120
padding: EdgeInsets.only(top: 4.0),
110-
child: Icon(Icons.arrow_drop_down),
121+
child: Icon(
122+
Icons.arrow_drop_down,
123+
color: foregroundColor,
124+
),
111125
),
112126
],
113127
),

lib/features/user/presentation/user_profile/view/user_profile_view.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class UserProfileView extends StatelessWidget {
4545
},
4646
),
4747
),
48-
backgroundColor: theme.colorScheme.tertiaryContainer,
48+
backgroundColor: theme.scaffoldBackgroundColor,
4949
body: SafeArea(
5050
child: Selector<UserProfileController, ViewState>(
5151
selector: (_, provider) => provider.viewState,

lib/features/user/presentation/user_profile/widgets/user_profile_user_info.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class UserProfileUserInfo extends StatelessWidget {
1919
leading: const SizedBox.shrink(),
2020
leadingWidth: 0,
2121
floating: true,
22-
backgroundColor: theme.colorScheme.tertiaryContainer,
2322
title: UserImageName(
2423
name: data.name,
2524
textStyle: theme.textTheme.bodyMedium,

0 commit comments

Comments
 (0)