Skip to content

Commit

Permalink
[ui] md3 migration | part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightDV committed Feb 11, 2024
1 parent d8bf750 commit f5b945c
Show file tree
Hide file tree
Showing 45 changed files with 770 additions and 1,222 deletions.
6 changes: 1 addition & 5 deletions lib/Screens/FormulaYou/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class _PersonalizedHomeScreenState extends State<PersonalizedHomeScreen> {
Widget build(BuildContext context) {
List selectedTags =
Hive.box('settings').get('selectedTags', defaultValue: []) as List;
bool useDarkMode =
Hive.box('settings').get('darkMode', defaultValue: true) as bool;
Map availableTags = FormulaYouTags().unifiedTags();
List selectedTagsIds = [];
for (String tagName in selectedTags) {
Expand Down Expand Up @@ -75,10 +73,8 @@ class _PersonalizedHomeScreenState extends State<PersonalizedHomeScreen> {
),
),
],
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
backgroundColor: useDarkMode
? Theme.of(context).scaffoldBackgroundColor
: Colors.white,
body: NewsFeed(
tagId: selectedTagsIds.join(','),
),
Expand Down
45 changes: 15 additions & 30 deletions lib/Screens/FormulaYou/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ class FormulaYouSettingsScreen extends StatefulWidget {
class _FormulaYouSettingsScreenState extends State<FormulaYouSettingsScreen> {
@override
Widget build(BuildContext context) {
bool useDarkMode =
Hive.box('settings').get('darkMode', defaultValue: true) as bool;
List selectedTags =
Hive.box('settings').get('selectedTags', defaultValue: []) as List;
List availableTags = FormulaYouTags().tags();
int i = 0;

return Scaffold(
backgroundColor: useDarkMode
? Theme.of(context).scaffoldBackgroundColor
: Colors.white,
appBar: AppBar(
title: Text(
AppLocalizations.of(context)!.formulaYouSettings,
Expand All @@ -53,6 +48,7 @@ class _FormulaYouSettingsScreenState extends State<FormulaYouSettingsScreen> {
fontSize: 18,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: ListView(
shrinkWrap: true,
Expand All @@ -68,33 +64,22 @@ class _FormulaYouSettingsScreenState extends State<FormulaYouSettingsScreen> {
? AppLocalizations.of(context)!.topics.capitalize()
: AppLocalizations.of(context)!.other.capitalize(),
),
collapsedIconColor: useDarkMode ? Colors.white : Colors.black,
collapsedTextColor: useDarkMode ? Colors.white : Colors.black,
children: [
for (String key in availableTags[i].keys.toList()..sort())
Theme(
data: Theme.of(context).copyWith(
unselectedWidgetColor:
useDarkMode ? Colors.white : Colors.black,
),
child: CheckboxListTile(
value: selectedTags.contains(key) ? true : false,
onChanged: (value) {
selectedTags.contains(key)
? selectedTags.remove(key)
: selectedTags.add(key);
Hive.box('settings').put('selectedTags', selectedTags);
if (widget.update != null) {
widget.update!();
}
setState(() {});
},
title: Text(
key,
style: TextStyle(
color: useDarkMode ? Colors.white : Colors.black,
),
),
CheckboxListTile(
value: selectedTags.contains(key) ? true : false,
onChanged: (value) {
selectedTags.contains(key)
? selectedTags.remove(key)
: selectedTags.add(key);
Hive.box('settings').put('selectedTags', selectedTags);
if (widget.update != null) {
widget.update!();
}
setState(() {});
},
title: Text(
key,
),
),
],
Expand Down
2 changes: 2 additions & 0 deletions lib/Screens/LivetimingArchive/races_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Copyright (c) 2022-2024, BrightDV
*/

// TODO: md3

import 'package:boxbox/Screens/LivetimingArchive/live_timing.dart';
import 'package:boxbox/Screens/schedule.dart';
import 'package:boxbox/api/ergast.dart';
Expand Down
6 changes: 2 additions & 4 deletions lib/Screens/MixedNews/edit_order.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,16 @@ class _EditOrderScreenState extends State<EditOrderScreen> {
'Thecheckeredflag.co.uk',
'Motorsportweek.com',
'Crash.net',
'Pitpass.com',
//'Pitpass.com', // TODO: fix Pitpass
],
) as List;
return Scaffold(
appBar: AppBar(
title: Text(
AppLocalizations.of(context)!.edit,
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
backgroundColor: useDarkMode
? Theme.of(context).scaffoldBackgroundColor
: Colors.white,
body: Theme(
data: ThemeData(
canvasColor: Colors.transparent,
Expand Down
62 changes: 4 additions & 58 deletions lib/Screens/MixedNews/mixed_news.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
'https://www.pitpass.com/fes_php/fes_usr_sit_newsfeed.php?fes_prepend_aty_sht_name=1',
};
return Scaffold(
backgroundColor: useDarkMode
? Theme.of(context).scaffoldBackgroundColor
: Colors.white,
appBar: AppBar(
title: Text(
AppLocalizations.of(context)!.newsMix,
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
actions: [
IconButton(
onPressed: () {
Expand All @@ -103,7 +101,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
},
icon: Icon(
useMergedFeeds ? Icons.splitscreen : Icons.merge,
color: Colors.white,
),
),
useMergedFeeds
Expand All @@ -119,7 +116,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
),
icon: const Icon(
Icons.edit,
color: Colors.white,
),
),
],
Expand All @@ -142,9 +138,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
color: useDarkMode
? const Color(0xff1d1d28)
: Colors.white,
child: InkWell(
onTap: () => Navigator.push(
context,
Expand Down Expand Up @@ -230,14 +223,11 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
.replaceAll('&#8220;', '"')
.replaceAll('&#8221;', '"'),
style: TextStyle(
color: useDarkMode
? Colors.white
: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w500,
),
overflow: TextOverflow.ellipsis,
maxLines: 5,
maxLines: 4,
textAlign: TextAlign.justify,
),
subtitle: newsLayout != 'big' &&
Expand Down Expand Up @@ -276,11 +266,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
styleSheet: MarkdownStyleSheet(
textAlign:
WrapAlignment.spaceBetween,
p: TextStyle(
color: useDarkMode
? Colors.grey[400]
: Colors.grey[800],
),
),
),
),
Expand Down Expand Up @@ -311,9 +296,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
)
.split('.')[0],
style: TextStyle(
color: useDarkMode
? Colors.white
: Colors.grey[900],
fontWeight: FontWeight.w500,
),
),
Expand Down Expand Up @@ -375,9 +357,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
Text(
feed,
style: TextStyle(
color: useDarkMode
? Colors.white
: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w500,
),
Expand All @@ -397,9 +376,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
child: Text(
AppLocalizations.of(context)!.viewMore,
style: TextStyle(
color: useDarkMode
? Colors.white
: Colors.black,
fontSize: 12,
fontWeight: FontWeight.w500,
decoration: TextDecoration.underline,
Expand All @@ -409,9 +385,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
),
Icon(
Icons.arrow_forward,
color: useDarkMode
? Colors.white
: Colors.black,
),
],
),
Expand Down Expand Up @@ -472,10 +445,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
),
child: Card(
elevation: 5.0,
color: useDarkMode
? const Color(
0xff1d1d28)
: Colors.white,
child: Column(
children: [
FutureBuilder<
Expand Down Expand Up @@ -525,11 +494,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
'"'),
style:
TextStyle(
color: useDarkMode
? Colors
.white
: Colors
.black,
fontSize:
14,
),
Expand All @@ -539,7 +503,7 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
textAlign:
TextAlign
.justify,
maxLines: 5,
maxLines: 4,
),
),
],
Expand Down Expand Up @@ -567,9 +531,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
Text(
feed,
style: TextStyle(
color: useDarkMode
? Colors.white
: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w500,
),
Expand All @@ -589,9 +550,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
child: Text(
AppLocalizations.of(context)!.viewMore,
style: TextStyle(
color: useDarkMode
? Colors.white
: Colors.black,
fontSize: 12,
fontWeight: FontWeight.w500,
decoration: TextDecoration.underline,
Expand All @@ -601,9 +559,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
),
Icon(
Icons.arrow_forward,
color: useDarkMode
? Colors.white
: Colors.black,
),
],
),
Expand Down Expand Up @@ -674,10 +629,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
),
child: Card(
elevation: 5.0,
color: useDarkMode
? const Color(
0xff1d1d28)
: Colors.white,
child: Column(
children: [
feedItem.enclosure !=
Expand Down Expand Up @@ -714,11 +665,6 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
.title!,
style:
TextStyle(
color: useDarkMode
? Colors
.white
: Colors
.black,
fontSize:
14,
),
Expand All @@ -728,7 +674,7 @@ class _MixedNewsScreenState extends State<MixedNewsScreen> {
textAlign:
TextAlign
.justify,
maxLines: 5,
maxLines: 4,
),
),
],
Expand Down
Loading

0 comments on commit f5b945c

Please sign in to comment.