Skip to content

Commit 9496fe7

Browse files
Merge pull request #621 from ganidande905/profile_inconsistency
Add bug: Fixed the theme inconsistency for the unselected profile sec…
2 parents e3a1adf + 4814408 commit 9496fe7

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

lib/app/modules/home/views/profile_config.dart

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1+
// ignore_for_file: lines_longer_than_80_chars
2+
13
import 'package:flutter/material.dart';
24
import 'package:get/get.dart';
3-
import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
45
import 'package:ultimate_alarm_clock/app/data/models/profile_model.dart';
56
import 'package:ultimate_alarm_clock/app/data/providers/isar_provider.dart';
67
import 'package:ultimate_alarm_clock/app/modules/home/controllers/home_controller.dart';
78
import 'package:ultimate_alarm_clock/app/modules/settings/controllers/theme_controller.dart';
89

910
import '../../../utils/constants.dart';
10-
import 'package:android_intent_plus/android_intent.dart';
1111

12-
import '../../../utils/utils.dart';
1312

1413
class ProfileSelect extends StatefulWidget {
1514
const ProfileSelect({super.key});
@@ -25,21 +24,21 @@ class _ProfileSelectState extends State<ProfileSelect> {
2524
@override
2625
Widget build(BuildContext context) {
2726
return Obx(() => AnimatedSwitcher(
28-
duration: Duration(milliseconds: 250),
27+
duration: const Duration(milliseconds: 250),
2928
transitionBuilder: (child, animation) {
3029
return SizeTransition(
31-
sizeFactor: animation, axis: Axis.horizontal, child: child);
30+
sizeFactor: animation, axis: Axis.horizontal, child: child,);
3231
},
3332
child: !controller.expandProfile.value
3433
? InkWell(
3534
onTap: () async {
3635
controller.isProfile.value = true;
3736
controller.isProfileUpdate.value = true;
3837
Get.toNamed('/add-update-alarm',
39-
arguments: controller.genFakeAlarmModel());
38+
arguments: controller.genFakeAlarmModel(),);
4039
},
4140
child: Container(
42-
key: ValueKey(1),
41+
key: const ValueKey(1),
4342
child: Row(
4443
children: [
4544
Padding(
@@ -57,15 +56,15 @@ class _ProfileSelectState extends State<ProfileSelect> {
5756
gradient: LinearGradient(
5857
begin: Alignment.topLeft,
5958
end: Alignment.topCenter,
60-
stops: [0.2, 0.2],
59+
stops: const [0.2, 0.2],
6160
colors: [
6261
kprimaryColor,
6362
themeController.secondaryBackgroundColor.value,
6463
],
6564
),
66-
borderRadius: BorderRadius.circular(18)),
65+
borderRadius: BorderRadius.circular(18),),
6766
child: Text(
68-
"${controller.selectedProfile}",
67+
'${controller.selectedProfile}',
6968
style: Theme.of(context)
7069
.textTheme
7170
.displaySmall!
@@ -76,23 +75,22 @@ class _ProfileSelectState extends State<ProfileSelect> {
7675
fontSize:
7776
22 * controller.scalingFactor.value,
7877
overflow: TextOverflow.ellipsis
79-
),
80-
)),
78+
,),
79+
),),
8180
),
8281
),
8382
Padding(
84-
padding: EdgeInsets.symmetric(horizontal: 8.0),
83+
padding: const EdgeInsets.symmetric(horizontal: 8.0),
8584
child: InkWell(
8685
borderRadius: BorderRadius.circular(28),
8786
onTap: () {
8887
controller.expandProfile.value =
8988
!controller.expandProfile.value;
9089
},
91-
child: Container(
92-
child: Padding(
93-
padding: const EdgeInsets.all(8.0),
94-
child: Icon(Icons.arrow_forward_ios),
95-
)),
90+
child: const Padding(
91+
padding: EdgeInsets.all(8.0),
92+
child: Icon(Icons.arrow_forward_ios),
93+
),
9694
),
9795
),
9896
InkWell(
@@ -101,17 +99,16 @@ class _ProfileSelectState extends State<ProfileSelect> {
10199
controller.isProfile.value = true;
102100
controller.profileModel.value =
103101
(await IsarDb.getProfile(
104-
controller.selectedProfile.value))!;
102+
controller.selectedProfile.value,))!;
105103
controller.isProfileUpdate.value = false;
106104
Get.toNamed(
107105
'/add-update-alarm',
108106
);
109107
},
110-
child: Container(
111-
child: Padding(
112-
padding: const EdgeInsets.all(8.0),
113-
child: Icon(Icons.add),
114-
)),
108+
child: const Padding(
109+
padding: EdgeInsets.all(8.0),
110+
child: Icon(Icons.add),
111+
),
115112
),
116113
],
117114
),
@@ -128,12 +125,12 @@ class _ProfileSelectState extends State<ProfileSelect> {
128125
controller.expandProfile.value =
129126
!controller.expandProfile.value;
130127
},
131-
child: Container(child: Icon(Icons.arrow_back_ios)),
128+
child: const Icon(Icons.arrow_back_ios),
132129
),
133130
),
134-
Container(
131+
SizedBox(
135132
width: Get.width * 0.8,
136-
key: ValueKey(2),
133+
key: const ValueKey(2),
137134
child: StreamBuilder(
138135
stream: IsarDb.getProfiles(),
139136
builder: (context, snapshot) {
@@ -149,10 +146,10 @@ class _ProfileSelectState extends State<ProfileSelect> {
149146
);
150147
}
151148
return SizedBox();
152-
}),
149+
},),
153150
),
154151
],
155-
)));
152+
),),);
156153
}
157154

158155
Widget profileCapsule(ProfileModel profile) {
@@ -172,18 +169,18 @@ class _ProfileSelectState extends State<ProfileSelect> {
172169
decoration: BoxDecoration(
173170
color: profile.profileName == controller.selectedProfile.value
174171
? kprimaryColor.withOpacity(0.5)
175-
: ksecondaryBackgroundColor,
176-
borderRadius: BorderRadius.circular(18)),
172+
: themeController.secondaryBackgroundColor.value,
173+
borderRadius: BorderRadius.circular(18),),
177174
child: Text(
178-
"${profile.profileName}",
175+
profile.profileName,
179176
style: Theme.of(context).textTheme.displaySmall!.copyWith(
180177
color: themeController.primaryTextColor.value.withOpacity(
181178
0.75,
182179
),
183180
fontSize: 22 * controller.scalingFactor.value,
184181
),
185182
),
186-
)),
183+
),),
187184
),
188185
);
189186
}

0 commit comments

Comments
 (0)