Skip to content

Commit

Permalink
Fixed the saved cards layout and fixed color scheme issues with too m…
Browse files Browse the repository at this point in the history
…any nested items(?)
  • Loading branch information
Akisame-AI committed Sep 3, 2023
1 parent 3902a70 commit 5e38ac3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
17 changes: 16 additions & 1 deletion chameleonultragui/lib/gui/page/saved_cards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ class SavedCardsPageState extends State<SavedCardsPage> {
}
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
return appState.sharedPreferencesProvider.getThemeComplementaryColor();
},
),
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
Expand All @@ -362,6 +367,7 @@ class SavedCardsPageState extends State<SavedCardsPage> {
return Container(
constraints: const BoxConstraints(minHeight: 80, maxHeight: 150),
child: ElevatedButton(

onPressed: () {
showDialog(
context: context,
Expand Down Expand Up @@ -458,6 +464,11 @@ class SavedCardsPageState extends State<SavedCardsPage> {
);
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
return appState.sharedPreferencesProvider.getThemeComplementaryColor();
},
),
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
Expand All @@ -479,7 +490,9 @@ class SavedCardsPageState extends State<SavedCardsPage> {
),
],
),
Expanded(
Positioned(top: 0,right: 0,
child: SizedBox(child: ConstrainedBox(constraints: BoxConstraints(minHeight: 80,),
child: Expanded(
flex: 1,
child: Wrap(
//mainAxisAlignment: MainAxisAlignment.end,
Expand Down Expand Up @@ -514,6 +527,8 @@ class SavedCardsPageState extends State<SavedCardsPage> {

),
),
),
),),
],
),
Positioned(
Expand Down
22 changes: 22 additions & 0 deletions chameleonultragui/lib/sharedprefsprovider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,28 @@ class SharedPreferencesProvider extends ChangeNotifier {
}
}

Color getThemeComplementaryColor() {
final themeValue = _sharedPreferences.getInt('app_theme_color') ?? 0;
switch (themeValue) {
case 1:
return Color.fromARGB(30, 116, 58, 183);
case 2:
return Color.fromARGB(44, 62, 216, 243);
case 3:
return Color.fromARGB(50, 175, 76, 172);
case 4:
return Color.fromARGB(46, 130, 51, 196);
case 5:
return Color.fromARGB(48, 110, 116, 29);
case 6:
return Color.fromARGB(47, 188, 43, 201);
case 7:
return Color.fromARGB(44, 58, 104, 202);
default:
return Color.fromARGB(16, 202, 43, 43);
}
}

void setThemeColor(int color) {
_sharedPreferences.setInt('app_theme_color', color);
}
Expand Down

0 comments on commit 5e38ac3

Please sign in to comment.