Skip to content

Commit

Permalink
[ui] lot of small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightDV committed Feb 21, 2024
1 parent 0126417 commit b81973c
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 83 deletions.
4 changes: 1 addition & 3 deletions lib/Screens/Compare/compare_drivers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ class CompareDriversScreen extends StatelessWidget {
appBar: AppBar(
title: const Text(
'Compare drivers',
style: TextStyle(
fontWeight: FontWeight.w600,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
backgroundColor: useDarkMode
? Theme.of(context).scaffoldBackgroundColor
Expand Down
4 changes: 1 addition & 3 deletions lib/Screens/Compare/compare_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ class _CompareHomeScreenState extends State<CompareHomeScreen> {
appBar: AppBar(
title: const Text(
'Compare',
style: TextStyle(
fontWeight: FontWeight.w600,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
backgroundColor: useDarkMode
? Theme.of(context).scaffoldBackgroundColor
Expand Down
4 changes: 1 addition & 3 deletions lib/Screens/Compare/compare_results.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ class CompareResultsScreen extends StatelessWidget {
appBar: AppBar(
title: const Text(
'Compare',
style: TextStyle(
fontWeight: FontWeight.w600,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: SingleChildScrollView(
child: Column(
Expand Down
3 changes: 0 additions & 3 deletions lib/Screens/FormulaYou/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ class _PersonalizedHomeScreenState extends State<PersonalizedHomeScreen> {
appBar: AppBar(
title: const Text(
'Formula You',
style: TextStyle(
fontWeight: FontWeight.w600,
),
),
actions: [
IconButton(
Expand Down
1 change: 0 additions & 1 deletion lib/Screens/FormulaYou/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class _FormulaYouSettingsScreenState extends State<FormulaYouSettingsScreen> {
title: Text(
AppLocalizations.of(context)!.formulaYouSettings,
style: const TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18,
),
),
Expand Down
1 change: 1 addition & 0 deletions lib/Screens/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class _SearchScreenState extends State<SearchScreen> {
),
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: results.isNotEmpty
? ListView.builder(
Expand Down
3 changes: 0 additions & 3 deletions lib/Screens/server_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ class _ServerSettingsScreenState extends State<ServerSettingsScreen> {
appBar: AppBar(
title: Text(
AppLocalizations.of(context)!.server,
style: const TextStyle(
fontWeight: FontWeight.w600,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
Expand Down
3 changes: 0 additions & 3 deletions lib/Screens/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
appBar: AppBar(
title: Text(
AppLocalizations.of(context)!.settings,
style: const TextStyle(
fontWeight: FontWeight.w600,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
Expand Down
3 changes: 0 additions & 3 deletions lib/Screens/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ class _VideoScreenState extends State<VideoScreen> {
)
: Marquee(
text: video.caption,
style: const TextStyle(
fontWeight: FontWeight.w600,
),
pauseAfterRound: const Duration(seconds: 1),
startAfter: const Duration(seconds: 1),
velocity: 85,
Expand Down
105 changes: 51 additions & 54 deletions lib/api/article_parts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ class WidgetsList extends StatelessWidget {
title: Text(
tag['fields']['tagName'],
),
backgroundColor:
Theme.of(context).colorScheme.onPrimary,
),
body: NewsFeed(tagId: tag['id']),
),
Expand Down Expand Up @@ -352,6 +354,9 @@ class WidgetsList extends StatelessWidget {
AppLocalizations.of(context)!
.quiz,
),
backgroundColor: Theme.of(context)
.colorScheme
.onPrimary,
),
body: InAppWebView(
initialUrlRequest: URLRequest(
Expand Down Expand Up @@ -530,6 +535,10 @@ class WidgetsList extends StatelessWidget {
context)!
.liveBlog,
),
backgroundColor:
Theme.of(context)
.colorScheme
.onPrimary,
),
body: InAppWebView(
initialUrlRequest:
Expand Down Expand Up @@ -1068,6 +1077,7 @@ class WidgetsList extends StatelessWidget {
? AppLocalizations.of(context)!.startingGrid
: AppLocalizations.of(context)!.qualifyings,
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
backgroundColor: Theme.of(context).colorScheme.background,
body: element['fields']['sessionType'] == 'Race' || element['fields']['sessionType'] == 'Sprint'
Expand Down Expand Up @@ -1502,67 +1512,54 @@ class WidgetsList extends StatelessWidget {
),

// bottom action bar
Padding(
padding: const EdgeInsets.all(5),
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[700]!),
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
IconButton(
icon: Icon(
Icons.share_outlined,
color: useDarkMode ? Colors.white : Colors.black,
),
onPressed: () => Share.share(
"https://www.formula1.com/en/latest/article.${article.articleSlug}.${article.articleId}.html",
),

Card(
elevation: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
IconButton(
icon: Icon(
Icons.share_outlined,
),
Text(
AppLocalizations.of(context)?.share ?? 'Share',
style: TextStyle(
color: useDarkMode ? Colors.white : Colors.black,
),
onPressed: () => Share.share(
"https://www.formula1.com/en/latest/article.${article.articleSlug}.${article.articleId}.html",
),
],
),
),
Text(
AppLocalizations.of(context)?.share ?? 'Share',
),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
IconButton(
icon: Icon(
Icons.schedule,
color: useDarkMode ? Colors.white : Colors.black,
),
onPressed: () {},
),
Text(
DateFormat('kk:mm\nyyyy-MM-dd')
.format(article.publishedDate),
textAlign: TextAlign.center,
style: TextStyle(
color: useDarkMode ? Colors.white : Colors.black,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
IconButton(
icon: Icon(
Icons.schedule,
),
],
),
onPressed: () {},
),
Text(
DateFormat('kk:mm\nyyyy-MM-dd')
.format(article.publishedDate),
textAlign: TextAlign.center,
),
],
),
),
],
),
),
],
),
),

Expand Down
9 changes: 8 additions & 1 deletion lib/helpers/loading_indicator_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,25 @@ class LoadingIndicatorUtil extends StatelessWidget {
final double? width;
final bool replaceImage;
final bool borderRadius;
final bool fullBorderRadius;
const LoadingIndicatorUtil({
Key? key,
this.width,
this.replaceImage = false,
this.borderRadius = true,
this.fullBorderRadius = true,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return replaceImage
? ClipRRect(
borderRadius: BorderRadius.circular(borderRadius ? 16.0 : 0),
borderRadius: fullBorderRadius
? BorderRadius.circular(16)
: BorderRadius.only(
topLeft: Radius.circular(borderRadius ? 16.0 : 0),
topRight: Radius.circular(borderRadius ? 16.0 : 0),
),
child: Image.asset('assets/images/image_loading_bg.png'),
)
: Padding(
Expand Down
14 changes: 8 additions & 6 deletions lib/helpers/news.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ class NewsItem extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
//color: useDarkMode ? const Color(0xff1d1d28) : Colors.white,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
child: InkWell(
Expand Down Expand Up @@ -211,6 +210,7 @@ class NewsItem extends StatelessWidget {
width: 300,
child: LoadingIndicatorUtil(
replaceImage: true,
fullBorderRadius: false,
),
),
errorWidget: (context, url, error) =>
Expand Down Expand Up @@ -269,6 +269,7 @@ class NewsItem extends StatelessWidget {
width: 300,
child: LoadingIndicatorUtil(
replaceImage: true,
fullBorderRadius: false,
),
),
errorWidget: (context, url, error) =>
Expand Down Expand Up @@ -385,6 +386,7 @@ class NewsItem extends StatelessWidget {
child:
const LoadingIndicatorUtil(
replaceImage: true,
fullBorderRadius: false,
),
),
errorWidget:
Expand Down Expand Up @@ -683,6 +685,7 @@ class NewsItem extends StatelessWidget {
: width / (16 / 9) - 10,
child: const LoadingIndicatorUtil(
replaceImage: true,
fullBorderRadius: false,
),
),
errorWidget:
Expand Down Expand Up @@ -1209,6 +1212,7 @@ class TextParagraphRenderer extends StatelessWidget {
fontWeight: FontWeight.w600,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: const StandingsScreen(),
),
Expand All @@ -1228,6 +1232,7 @@ class TextParagraphRenderer extends StatelessWidget {
fontWeight: FontWeight.w600,
),
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: const StandingsScreen(
switchToTeamStandings: true,
Expand All @@ -1248,6 +1253,7 @@ class TextParagraphRenderer extends StatelessWidget {
title: Text(
AppLocalizations.of(context)!.schedule,
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: const ScheduleScreen(),
),
Expand Down Expand Up @@ -1297,11 +1303,7 @@ class TextParagraphRenderer extends StatelessWidget {
strong: TextStyle(
fontSize: fontUsedInArticles == 'Formula1' ? 16 : 20,
fontWeight: FontWeight.w500,
color: useDarkMode
? HSLColor.fromColor(
Theme.of(context).colorScheme.onPrimary,
).withLightness(0.35).toColor()
: Theme.of(context).colorScheme.onPrimary,
color: Theme.of(context).colorScheme.onPrimary,
),
p: TextStyle(
fontSize: fontUsedInArticles == 'Formula1' ? 14 : 18,
Expand Down
4 changes: 4 additions & 0 deletions lib/helpers/route_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ArticleUrlHandler extends StatelessWidget {
title: Text(
AppLocalizations.of(context)!.schedule,
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: const ScheduleScreen(),
);
Expand All @@ -93,6 +94,7 @@ class ArticleUrlHandler extends StatelessWidget {
title: Text(
AppLocalizations.of(context)!.schedule,
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: const StandingsScreen(),
);
Expand All @@ -102,6 +104,7 @@ class ArticleUrlHandler extends StatelessWidget {
title: Text(
AppLocalizations.of(context)!.schedule,
),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: const StandingsScreen(
switchToTeamStandings: true,
Expand All @@ -111,6 +114,7 @@ class ArticleUrlHandler extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: const Text('Intent'),
backgroundColor: Theme.of(context).colorScheme.onPrimary,
),
body: Center(
child: Padding(
Expand Down
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ class NotificationController {
builder: (context) => Scaffold(
appBar: AppBar(
title: const Text('wrong payload'),
backgroundColor:
Theme.of(context).colorScheme.onPrimary,
),
body: Center(
child: Text(
Expand Down

0 comments on commit b81973c

Please sign in to comment.