diff --git a/lib/app.dart b/lib/app.dart new file mode 100644 index 0000000..e764914 --- /dev/null +++ b/lib/app.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:git_touch/home.dart'; +import 'package:git_touch/models/auth.dart'; +import 'package:git_touch/models/theme.dart'; +import 'package:provider/provider.dart'; +import 'package:git_touch/screens/login.dart'; + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + final auth = Provider.of(context); + final theme = Provider.of(context); + + final themData = ThemeData( + brightness: theme.brightness, + // primaryColorBrightness: theme.brightness, + primaryColorLight: theme.paletteLight.background, + primaryColorDark: theme.paletteDark.background, + ); + + // TODO: + if (!auth.ready || !Provider.of(context).ready) { + return MaterialApp(theme: themData, home: Scaffold(body: Text('a'))); + } + + // Fimber.d(settings.activeLogin); + if (auth.activeAccount == null) { + return MaterialApp(theme: themData, home: LoginScreen()); + } + + switch (theme.theme) { + case AppThemeType.cupertino: + return CupertinoApp( + theme: CupertinoThemeData(brightness: theme.brightness), + home: Home(), + ); + default: + return MaterialApp( + theme: themData, + home: Home(), + ); + } + } +} diff --git a/lib/home.dart b/lib/home.dart new file mode 100644 index 0000000..3884e26 --- /dev/null +++ b/lib/home.dart @@ -0,0 +1,153 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:git_touch/models/auth.dart'; +import 'package:git_touch/models/notification.dart'; +import 'package:git_touch/models/theme.dart'; +import 'package:git_touch/screens/gitlab_todos.dart'; +import 'package:git_touch/screens/gitlab_user.dart'; +import 'package:git_touch/screens/notification.dart'; +import 'package:git_touch/screens/user.dart'; +import 'package:git_touch/utils/utils.dart'; +import 'package:provider/provider.dart'; +import 'package:git_touch/screens/news.dart'; +import 'package:git_touch/screens/search.dart'; +import 'package:git_touch/screens/trending.dart'; + +class Home extends StatefulWidget { + @override + _HomeState createState() => _HomeState(); +} + +class _HomeState extends State { + int active = 0; + + _buildScreen(int index) { + // return GitlabProjectScreen(32221); + // return IssuesScreen('flutter', 'flutter', isPullRequest: true); + // return IssueScreen('reactjs', 'rfcs', 29); + // return IssueScreen('reactjs', 'rfcs', 68, isPullRequest: true); + // return Image.asset('images/spinner.webp', width: 32, height: 32); + final auth = Provider.of(context); + + switch (auth.activeAccount.platform) { + case PlatformType.github: + switch (index) { + case 0: + return NewsScreen(); + case 1: + return NotificationScreen(); + case 2: + return TrendingScreen(); + case 3: + return SearchScreen(); + case 4: + return UserScreen(''); + } + break; + case PlatformType.gitlab: + switch (index) { + case 0: + return GitlabTodosScreen(); + case 1: + return GitlabUserScreen(auth.activeAccount.gitlabId); + } + break; + } + } + + Widget _buildNotificationIcon(BuildContext context, bool isActive) { + final theme = Provider.of(context); + final iconData = Icons.notifications; + int count = Provider.of(context).count; + if (count == 0) { + return Icon(iconData); + } + + // String text = count > 99 ? '99+' : count.toString(); + return Stack( + children: [ + Icon(iconData), + Positioned( + right: -2, + top: -2, + child: Icon(Octicons.primitive_dot, + color: theme.paletteOf(context).primary, size: 14)) + ], + ); + } + + List get _navigationItems { + switch (Provider.of(context).activeAccount.platform) { + case PlatformType.github: + return [ + BottomNavigationBarItem( + icon: Icon(Icons.rss_feed), + title: Text('News'), + ), + BottomNavigationBarItem( + icon: _buildNotificationIcon(context, false), + activeIcon: _buildNotificationIcon(context, true), + title: Text('Notification'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.whatshot), + title: Text('Trending'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.search), + title: Text('Search'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.person), + activeIcon: Icon(Icons.person), + title: Text('Me'), + ), + ]; + case PlatformType.gitlab: + return [ + BottomNavigationBarItem( + icon: Icon(Icons.timeline), + title: Text('Todos'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.person_outline), + activeIcon: Icon(Icons.person), + title: Text('Me'), + ), + ]; + } + } + + @override + Widget build(BuildContext context) { + final theme = Provider.of(context); + + switch (theme.theme) { + case AppThemeType.cupertino: + return CupertinoTabScaffold( + tabBar: CupertinoTabBar(items: _navigationItems), + tabBuilder: (context, index) { + return CupertinoTabView(builder: (context) { + return _buildScreen(index); + }); + }, + ); + + default: + return Scaffold( + body: _buildScreen(active), + bottomNavigationBar: BottomNavigationBar( + // selectedItemColor: theme.paletteOf(context).primary, + items: _navigationItems, + currentIndex: active, + type: BottomNavigationBarType.fixed, + onTap: (int index) { + setState(() { + active = index; + }); + }, + ), + ); + } + } +} diff --git a/lib/main.dart b/lib/main.dart index 352de3e..8a73dbe 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; +import 'package:git_touch/app.dart'; import 'package:git_touch/models/code.dart'; import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/theme.dart'; @@ -9,12 +10,10 @@ import 'package:git_touch/screens/commits.dart'; import 'package:git_touch/screens/gitlab_blob.dart'; import 'package:git_touch/screens/gitlab_issue.dart'; import 'package:git_touch/screens/gitlab_project.dart'; -import 'package:git_touch/screens/gitlab_todos.dart'; import 'package:git_touch/screens/gitlab_tree.dart'; import 'package:git_touch/screens/gitlab_user.dart'; import 'package:git_touch/screens/issue_form.dart'; import 'package:git_touch/screens/issues.dart'; -import 'package:git_touch/screens/notification.dart'; import 'package:git_touch/screens/object.dart'; import 'package:git_touch/screens/repository.dart'; import 'package:git_touch/screens/settings.dart'; @@ -25,179 +24,10 @@ import 'package:git_touch/utils/utils.dart'; import 'package:provider/provider.dart'; import 'package:git_touch/models/notification.dart'; import 'package:fluro/fluro.dart'; -import 'package:git_touch/screens/news.dart'; -import 'package:git_touch/screens/search.dart'; import 'package:git_touch/screens/login.dart'; import 'package:git_touch/screens/issue.dart'; -import 'package:git_touch/screens/trending.dart'; import 'package:fimber/fimber.dart'; -class Home extends StatefulWidget { - @override - _HomeState createState() => _HomeState(); -} - -class _HomeState extends State { - int active = 0; - // String login; - - Widget _buildNotificationIcon(BuildContext context, bool isActive) { - final theme = Provider.of(context); - final iconData = Icons.notifications; - int count = Provider.of(context).count; - if (count == 0) { - return Icon(iconData); - } - - // String text = count > 99 ? '99+' : count.toString(); - return Stack( - children: [ - Icon(iconData), - Positioned( - right: -2, - top: -2, - child: Icon(Octicons.primitive_dot, - color: theme.palette.primary, size: 14)) - ], - ); - } - - List get _navigationItems { - switch (Provider.of(context).activeAccount.platform) { - case PlatformType.github: - return [ - BottomNavigationBarItem( - icon: Icon(Icons.rss_feed), - title: Text('News'), - ), - BottomNavigationBarItem( - icon: _buildNotificationIcon(context, false), - activeIcon: _buildNotificationIcon(context, true), - title: Text('Notification'), - ), - BottomNavigationBarItem( - icon: Icon(Icons.whatshot), - title: Text('Trending'), - ), - BottomNavigationBarItem( - icon: Icon(Icons.search), - title: Text('Search'), - ), - BottomNavigationBarItem( - icon: Icon(Icons.person), - activeIcon: Icon(Icons.person), - title: Text('Me'), - ), - ]; - case PlatformType.gitlab: - return [ - BottomNavigationBarItem( - icon: Icon(Icons.timeline), - title: Text('Todos'), - ), - BottomNavigationBarItem( - icon: Icon(Icons.person_outline), - activeIcon: Icon(Icons.person), - title: Text('Me'), - ), - ]; - } - } - - _buildScreen(int index) { - // return GitlabProjectScreen(32221); - // return IssuesScreen('flutter', 'flutter', isPullRequest: true); - // return IssueScreen('reactjs', 'rfcs', 29); - // return IssueScreen('reactjs', 'rfcs', 68, isPullRequest: true); - // return Image.asset('images/spinner.webp', width: 32, height: 32); - final auth = Provider.of(context); - - switch (auth.activeAccount.platform) { - case PlatformType.github: - switch (index) { - case 0: - return NewsScreen(); - case 1: - return NotificationScreen(); - case 2: - return TrendingScreen(); - case 3: - return SearchScreen(); - case 4: - return UserScreen(''); - } - break; - case PlatformType.gitlab: - switch (index) { - case 0: - return GitlabTodosScreen(); - case 1: - return GitlabUserScreen(auth.activeAccount.gitlabId); - } - break; - } - } - - @override - Widget build(BuildContext context) { - final auth = Provider.of(context); - final theme = Provider.of(context); - - final themData = ThemeData( - brightness: theme.brightnessEnum, - primaryColor: theme.palette.background, - ); - - // TODO: - if (!auth.ready || !Provider.of(context).ready) { - return MaterialApp(theme: themData, home: Scaffold(body: Text('a'))); - } - - // Fimber.d(settings.activeLogin); - if (auth.activeAccount == null) { - return MaterialApp(theme: themData, home: LoginScreen()); - } - - switch (theme.theme) { - case AppThemeType.cupertino: - return CupertinoApp( - theme: CupertinoThemeData( - brightness: theme.brightnessEnum, - primaryColor: theme.palette.primary, - ), - home: CupertinoTabScaffold( - tabBar: CupertinoTabBar(items: _navigationItems), - tabBuilder: (context, index) { - return CupertinoTabView( - builder: (context) { - return _buildScreen(index); - }, - ); - }, - ), - ); - default: - return MaterialApp( - theme: themData, - home: Scaffold( - body: _buildScreen(active), - bottomNavigationBar: BottomNavigationBar( - selectedItemColor: theme.palette.primary, - items: _navigationItems, - currentIndex: active, - type: BottomNavigationBarType.fixed, - onTap: (int index) { - setState(() { - active = index; - }); - }, - ), - ), - ); - } - } -} - void main() async { WidgetsFlutterBinding.ensureInitialized(); // Platform messages may fail, so we use a try/catch PlatformException. @@ -264,6 +94,6 @@ void main() async { ChangeNotifierProvider(create: (context) => authModel), ChangeNotifierProvider(create: (context) => codeModel), ], - child: Home(), + child: MyApp(), )); } diff --git a/lib/models/theme.dart b/lib/models/theme.dart index e01a276..e0767a2 100644 --- a/lib/models/theme.dart +++ b/lib/models/theme.dart @@ -21,11 +21,11 @@ class AppThemeType { } class AppBrightnessType { - // static const followSystem = 0; + static const followSystem = 0; static const light = 1; static const dark = 2; static const values = [ - // AppBrightnessType.followSystem, + AppBrightnessType.followSystem, AppBrightnessType.light, AppBrightnessType.dark ]; @@ -77,15 +77,15 @@ class StaticRoute extends PageRouteBuilder { } class Palette { - Color primary; - Color text; - Color secondaryText; - Color tertiaryText; - Color background; - Color grayBackground; - Color border; + final Color primary; + final Color text; + final Color secondaryText; + final Color tertiaryText; + final Color background; + final Color grayBackground; + final Color border; - Palette({ + const Palette({ this.primary, this.text, this.secondaryText, @@ -104,9 +104,23 @@ class ThemeModel with ChangeNotifier { int get theme => _theme; bool get ready => _theme != null; - int _brightnessValue = AppBrightnessType.light; + int _brightnessValue = AppBrightnessType.followSystem; int get brighnessValue => _brightnessValue; - Brightness get brightnessEnum { + + /// not null + Brightness brightnessOf(BuildContext context) { + switch (_brightnessValue) { + case AppBrightnessType.light: + return Brightness.light; + case AppBrightnessType.dark: + return Brightness.dark; + default: + return MediaQuery.of(context).platformBrightness; + } + } + + // could be null + Brightness get brightness { switch (_brightnessValue) { case AppBrightnessType.light: return Brightness.light; @@ -127,30 +141,33 @@ class ThemeModel with ChangeNotifier { final router = Router(); - Palette get palette { - switch (brightnessEnum) { + final paletteLight = Palette( + primary: Colors.blueAccent.shade700, + text: Colors.black, + secondaryText: Colors.grey.shade800, + tertiaryText: Colors.grey.shade600, + background: Colors.white, + grayBackground: Colors.grey.shade100, + border: Colors.grey.shade400, + ); + final paletteDark = Palette( + primary: Colors.blueAccent.shade200, + text: Colors.grey.shade300, + secondaryText: Colors.grey.shade400, + tertiaryText: Colors.grey.shade500, + background: Colors.black, + grayBackground: Colors.grey.shade900, + border: Colors.grey.shade700, + ); + + Palette paletteOf(BuildContext context) { + switch (brightnessOf(context)) { case Brightness.light: - return Palette( - primary: Colors.blueAccent.shade700, - text: Colors.black, - secondaryText: Colors.grey.shade800, - tertiaryText: Colors.grey.shade600, - background: Colors.white, - grayBackground: Colors.grey.shade100, - border: Colors.grey.shade400, - ); + return paletteLight; case Brightness.dark: - return Palette( - primary: Colors.blueAccent.shade200, - text: Colors.grey.shade300, - secondaryText: Colors.grey.shade400, - tertiaryText: Colors.grey.shade500, - background: Colors.black, - grayBackground: Colors.grey.shade900, - border: Colors.grey.shade700, - ); + return paletteDark; default: - return null; + throw 'brightnessOf should not return null'; } } @@ -350,7 +367,7 @@ class ThemeModel with ChangeNotifier { return Container( height: 216, child: CupertinoPicker( - backgroundColor: palette.background, + backgroundColor: paletteOf(context).background, children: groupItem.items.map((v) => Text(v.text)).toList(), itemExtent: 40, scrollController: FixedExtentScrollController( diff --git a/lib/scaffolds/common.dart b/lib/scaffolds/common.dart index 671bc2a..82f9f0b 100644 --- a/lib/scaffolds/common.dart +++ b/lib/scaffolds/common.dart @@ -32,7 +32,7 @@ class CommonScaffold extends StatelessWidget { default: return Scaffold( appBar: AppBar( - brightness: theme.brightnessEnum, + brightness: theme.brightnessOf(context), title: title, actions: [ if (action != null) action, diff --git a/lib/scaffolds/long_list.dart b/lib/scaffolds/long_list.dart index bee6b14..0aa16f1 100644 --- a/lib/scaffolds/long_list.dart +++ b/lib/scaffolds/long_list.dart @@ -134,20 +134,21 @@ class _LongListStatefulScaffoldState child: Container( padding: CommonStyle.padding, decoration: BoxDecoration( - border: Border.all(color: theme.palette.text), + border: Border.all(color: theme.paletteOf(context).text), ), child: Column( children: [ Text('$count hidden items', - style: - TextStyle(color: theme.palette.text, fontSize: 15)), + style: TextStyle( + color: theme.paletteOf(context).text, fontSize: 15)), Padding(padding: EdgeInsets.only(top: 4)), loadingMore ? CupertinoActivityIndicator() : Text( 'Load more...', style: TextStyle( - color: theme.palette.primary, fontSize: 16), + color: theme.paletteOf(context).primary, + fontSize: 16), ), ], ), diff --git a/lib/screens/about.dart b/lib/screens/about.dart index dc7c581..696dbbc 100644 --- a/lib/screens/about.dart +++ b/lib/screens/about.dart @@ -51,7 +51,8 @@ class _AboutScreenState extends State { SizedBox(height: 12), Text( 'GitTouch', - style: TextStyle(fontSize: 20, color: theme.palette.text), + style: + TextStyle(fontSize: 20, color: theme.paletteOf(context).text), ), SizedBox(height: 48), TableView(items: [ diff --git a/lib/screens/commits.dart b/lib/screens/commits.dart index 8879919..b1614b3 100644 --- a/lib/screens/commits.dart +++ b/lib/screens/commits.dart @@ -79,7 +79,7 @@ class CommitsScreen extends StatelessWidget { payload.messageHeadline, style: TextStyle( fontSize: 17, - color: theme.palette.text, + color: theme.paletteOf(context).text, ), overflow: TextOverflow.ellipsis, ), @@ -93,7 +93,7 @@ class CommitsScreen extends StatelessWidget { Text( ' committed ${timeago.format(payload.committedDate)}', style: TextStyle( - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, fontSize: 15, ), ), diff --git a/lib/screens/gitlab_project.dart b/lib/screens/gitlab_project.dart index 18457e2..5333f82 100644 --- a/lib/screens/gitlab_project.dart +++ b/lib/screens/gitlab_project.dart @@ -85,7 +85,7 @@ class GitlabProjectScreen extends StatelessWidget { CommonStyle.verticalGap, if (data.languages.isNotEmpty) Container( - color: theme.palette.background, + color: theme.paletteOf(context).background, padding: CommonStyle.padding.copyWith(top: 8, bottom: 8), child: ClipRRect( borderRadius: BorderRadius.circular(2), @@ -132,7 +132,7 @@ class GitlabProjectScreen extends StatelessWidget { if (data.readme != null) Container( padding: CommonStyle.padding, - color: theme.palette.background, + color: theme.paletteOf(context).background, child: MarkdownView(data.readme), ), CommonStyle.verticalGap, diff --git a/lib/screens/gitlab_project_activity.dart b/lib/screens/gitlab_project_activity.dart index 536f1c3..d411aa4 100644 --- a/lib/screens/gitlab_project_activity.dart +++ b/lib/screens/gitlab_project_activity.dart @@ -47,7 +47,7 @@ class GitlabProjectActivity extends StatelessWidget { TextSpan( text: data.author.name, style: TextStyle( - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontWeight: FontWeight.w500, ), ), diff --git a/lib/screens/gitlab_todos.dart b/lib/screens/gitlab_todos.dart index b7d6f3d..e392054 100644 --- a/lib/screens/gitlab_todos.dart +++ b/lib/screens/gitlab_todos.dart @@ -13,7 +13,7 @@ class GitlabTodosScreen extends StatelessWidget { final theme = Provider.of(context); return TextSpan( text: p.author.name, - style: TextStyle(color: theme.palette.primary), + style: TextStyle(color: theme.paletteOf(context).primary), ); } @@ -21,7 +21,7 @@ class GitlabTodosScreen extends StatelessWidget { final theme = Provider.of(context); return TextSpan( text: '${p.project.pathWithNamespace}!${p.target.iid}', - style: TextStyle(color: theme.palette.primary), + style: TextStyle(color: theme.paletteOf(context).primary), ); } @@ -85,7 +85,8 @@ class GitlabTodosScreen extends StatelessWidget { child: Text.rich( TextSpan( style: TextStyle( - color: theme.palette.text, fontSize: 17), + color: theme.paletteOf(context).text, + fontSize: 17), children: [ ..._buildItem(context, item), ], diff --git a/lib/screens/image_view.dart b/lib/screens/image_view.dart index 7b290f6..792a2a1 100644 --- a/lib/screens/image_view.dart +++ b/lib/screens/image_view.dart @@ -18,7 +18,8 @@ class ImageViewScreen extends StatelessWidget { title: title, body: PhotoView( imageProvider: NetworkImage(url), - backgroundDecoration: BoxDecoration(color: theme.palette.background), + backgroundDecoration: + BoxDecoration(color: theme.paletteOf(context).background), ), ); } diff --git a/lib/screens/issue.dart b/lib/screens/issue.dart index 2b11c19..2f82169 100644 --- a/lib/screens/issue.dart +++ b/lib/screens/issue.dart @@ -428,7 +428,7 @@ mutation { '$owner / $name', style: TextStyle( fontSize: 17, - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, ), ), SizedBox(width: 4), @@ -436,7 +436,7 @@ mutation { '#$number', style: TextStyle( fontSize: 17, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, ), ), ], @@ -463,7 +463,7 @@ mutation { Text( '${p['changedFiles']} files changed', style: TextStyle( - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, fontSize: 17, ), ), @@ -486,7 +486,7 @@ mutation { ), Icon( Icons.chevron_right, - color: theme.palette.border, + color: theme.paletteOf(context).border, ), ], ) diff --git a/lib/screens/login.dart b/lib/screens/login.dart index 245d485..f6026f4 100644 --- a/lib/screens/login.dart +++ b/lib/screens/login.dart @@ -36,7 +36,8 @@ class _LoginScreenState extends State { child: Container( padding: CommonStyle.padding, decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: theme.palette.border)), + border: Border( + bottom: BorderSide(color: theme.paletteOf(context).border)), ), child: Row( children: [ @@ -68,7 +69,8 @@ class _LoginScreenState extends State { child: Container( padding: EdgeInsets.symmetric(vertical: 20), decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: theme.palette.border)), + border: Border( + bottom: BorderSide(color: theme.paletteOf(context).border)), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -125,7 +127,8 @@ class _LoginScreenState extends State { Text( 'user, repo, read:org', style: TextStyle( - fontSize: 16, color: theme.palette.primary), + fontSize: 16, + color: theme.paletteOf(context).primary), ) ], ), @@ -175,7 +178,7 @@ class _LoginScreenState extends State { // Text( // 'api, read_user, read_repository', // style: TextStyle( - // fontSize: 16, color: theme.palette.primary), + // fontSize: 16, color: theme.paletteOf(context).primary), // ) // ], // ), diff --git a/lib/screens/notification.dart b/lib/screens/notification.dart index 54ab6cf..5193c15 100644 --- a/lib/screens/notification.dart +++ b/lib/screens/notification.dart @@ -114,7 +114,7 @@ ${item.key}: pullRequest(number: ${item.subject.number}) { style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, - color: theme.palette.text, + color: theme.paletteOf(context).text, ), ), GestureDetector( @@ -125,7 +125,7 @@ ${item.key}: pullRequest(number: ${item.subject.number}) { }, child: Icon( Octicons.check, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, size: 24, ), ), diff --git a/lib/screens/object.dart b/lib/screens/object.dart index 4336fb0..dfadd6d 100644 --- a/lib/screens/object.dart +++ b/lib/screens/object.dart @@ -152,7 +152,7 @@ class ObjectScreen extends StatelessWidget { return PhotoView( imageProvider: NetworkImage(rawUrl), backgroundDecoration: - BoxDecoration(color: theme.palette.background), + BoxDecoration(color: theme.paletteOf(context).background), ); case 'md': case 'markdown': @@ -169,9 +169,10 @@ class ObjectScreen extends StatelessWidget { child: HighlightView( text, language: _language, - theme: themeMap[theme.brightnessEnum == Brightness.dark - ? codeProvider.themeDark - : codeProvider.theme], + theme: themeMap[ + theme.brightnessOf(context) == Brightness.dark + ? codeProvider.themeDark + : codeProvider.theme], padding: CommonStyle.padding, textStyle: TextStyle( fontSize: codeProvider.fontSize.toDouble(), diff --git a/lib/screens/repository.dart b/lib/screens/repository.dart index 5960667..9ec04b7 100644 --- a/lib/screens/repository.dart +++ b/lib/screens/repository.dart @@ -143,7 +143,7 @@ class RepositoryScreen extends StatelessWidget { '$owner / $name', style: TextStyle( fontSize: 20, - color: theme.palette.primary, + color: theme.paletteOf(context).primary, ), ), ], @@ -170,7 +170,7 @@ class RepositoryScreen extends StatelessWidget { Text( repo.description, style: TextStyle( - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, fontSize: 17, ), ), @@ -180,7 +180,7 @@ class RepositoryScreen extends StatelessWidget { child: Text( repo.homepageUrl, style: TextStyle( - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontSize: 17, ), ), @@ -194,8 +194,8 @@ class RepositoryScreen extends StatelessWidget { return MyLabel( name: node.topic.name, // color: Colors.blue.shade50, - color: theme.palette.grayBackground, - textColor: theme.palette.primary, + color: theme.paletteOf(context).grayBackground, + textColor: theme.paletteOf(context).primary, ); }).toList(), ) @@ -233,7 +233,7 @@ class RepositoryScreen extends StatelessWidget { context: context, builder: (context) { return Container( - color: theme.palette.background, + color: theme.paletteOf(context).background, padding: EdgeInsets.all(40), height: 400, child: charts.PieChart( @@ -268,7 +268,7 @@ class RepositoryScreen extends StatelessWidget { ); }, child: Container( - // color: theme.palette.background, + // color: theme.paletteOf(context).background, padding: CommonStyle.padding.copyWith(top: 8, bottom: 8), child: ClipRRect( borderRadius: BorderRadius.circular(5), @@ -364,7 +364,7 @@ class RepositoryScreen extends StatelessWidget { if (readme != null) Container( padding: CommonStyle.padding, - color: theme.palette.background, + color: theme.paletteOf(context).background, child: MarkdownView( readme, basePaths: [owner, name, branch ?? 'master'], // TODO: diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 9aa1aa4..7462d56 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -17,7 +17,7 @@ class SettingsScreen extends StatelessWidget { Widget _buildRightWidget(BuildContext context, bool checked) { final theme = Provider.of(context); if (!checked) return null; - return Icon(Icons.check, color: theme.palette.primary, size: 24); + return Icon(Icons.check, color: theme.paletteOf(context).primary, size: 24); } @override @@ -63,7 +63,7 @@ class SettingsScreen extends StatelessWidget { TableView( headerText: 'BRIGHTNESS', items: [ - // Tuple2('Follow System', AppBrightnessType.followSystem), + Tuple2('Follow System', AppBrightnessType.followSystem), Tuple2('Light', AppBrightnessType.light), Tuple2('Dark', AppBrightnessType.dark), ].map((t) { diff --git a/lib/screens/trending.dart b/lib/screens/trending.dart index dbb72cc..d45f8ad 100644 --- a/lib/screens/trending.dart +++ b/lib/screens/trending.dart @@ -53,7 +53,7 @@ class TrendingScreen extends StatelessWidget { Icon( Octicons.repo, size: 15, - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, ), SizedBox(width: 2), Text(item.repo.name) diff --git a/lib/screens/user.dart b/lib/screens/user.dart index e6b1650..a9f25eb 100644 --- a/lib/screens/user.dart +++ b/lib/screens/user.dart @@ -107,7 +107,7 @@ class UserScreen extends StatelessWidget { Text( name, style: TextStyle( - color: theme.palette.text, + color: theme.paletteOf(context).text, fontSize: 20, fontWeight: FontWeight.w600, ), @@ -117,7 +117,7 @@ class UserScreen extends StatelessWidget { Text( login, style: TextStyle( - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontSize: 18, ), ), @@ -127,13 +127,13 @@ class UserScreen extends StatelessWidget { Icon( Octicons.clock, size: 16, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, ), SizedBox(width: 4), Text( 'Joined on ${dateFormat.format(createdAt)}', style: TextStyle( - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, fontSize: 16, ), ), @@ -144,7 +144,7 @@ class UserScreen extends StatelessWidget { Text( bio, style: TextStyle( - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, fontSize: 17, ), ) @@ -216,7 +216,7 @@ class UserScreen extends StatelessWidget { ]), CommonStyle.border, Container( - color: theme.palette.background, + color: theme.paletteOf(context).background, padding: CommonStyle.padding, child: SingleChildScrollView( scrollDirection: Axis.horizontal, @@ -230,7 +230,7 @@ class UserScreen extends StatelessWidget { spacing: 3, children: week.contributionDays.map((day) { var color = convertColor(day.color); - if (theme.brightnessEnum == Brightness.dark) { + if (theme.brightnessOf(context) == Brightness.dark) { color = Color.fromRGBO(0xff - color.red, 0xff - color.green, 0xff - color.blue, 1); } @@ -256,7 +256,8 @@ class UserScreen extends StatelessWidget { leftIconData: Octicons.organization, text: TextContainsOrganization( p.company, - style: TextStyle(fontSize: 17, color: theme.palette.text), + style: TextStyle( + fontSize: 17, color: theme.paletteOf(context).text), oneLine: true, ), ), diff --git a/lib/screens/users.dart b/lib/screens/users.dart index 63c7aef..f4962e7 100644 --- a/lib/screens/users.dart +++ b/lib/screens/users.dart @@ -104,7 +104,7 @@ class UsersScreen extends StatelessWidget { Icon( Octicons.organization, size: 15, - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, ), SizedBox(width: 4), Text(company), @@ -117,7 +117,7 @@ class UsersScreen extends StatelessWidget { Icon( Octicons.location, size: 15, - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, ), SizedBox(width: 4), Text(location), @@ -129,7 +129,7 @@ class UsersScreen extends StatelessWidget { Icon( Octicons.clock, size: 15, - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, ), SizedBox(width: 4), Text('Joined on ${dateFormat.format(createdAt)}'), diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 7e7ef7e..e6ce56c 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -60,7 +60,7 @@ TextSpan createLinkSpan( return TextSpan( text: text, style: TextStyle( - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontWeight: FontWeight.w600, ), recognizer: TapGestureRecognizer() @@ -154,7 +154,7 @@ class PrimerBranchName extends StatelessWidget { child: Text( name, style: TextStyle( - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontSize: 14, height: 1, fontFamily: CommonStyle.monospace, diff --git a/lib/widgets/blob_view.dart b/lib/widgets/blob_view.dart index e1c45fc..f03114a 100644 --- a/lib/widgets/blob_view.dart +++ b/lib/widgets/blob_view.dart @@ -39,7 +39,8 @@ class BlobView extends StatelessWidget { case 'webp': return PhotoView( imageProvider: NetworkImage(payload), - backgroundDecoration: BoxDecoration(color: theme.palette.background), + backgroundDecoration: + BoxDecoration(color: theme.paletteOf(context).background), ); case 'md': case 'markdown': diff --git a/lib/widgets/border_view.dart b/lib/widgets/border_view.dart index b9cbb72..5deea5c 100644 --- a/lib/widgets/border_view.dart +++ b/lib/widgets/border_view.dart @@ -21,7 +21,7 @@ class BorderView extends StatelessWidget { margin: EdgeInsets.only(left: leftPadding), decoration: BoxDecoration( border: Border( - top: BorderSide(color: theme.palette.border, width: 0), + top: BorderSide(color: theme.paletteOf(context).border, width: 0), ), ), ); @@ -33,14 +33,15 @@ class BorderView extends StatelessWidget { width: leftPadding, height: height, child: DecoratedBox( - decoration: BoxDecoration(color: theme.palette.background), + decoration: + BoxDecoration(color: theme.paletteOf(context).background), ), ), Expanded( child: SizedBox( height: height, child: DecoratedBox( - decoration: BoxDecoration(color: theme.palette.border), + decoration: BoxDecoration(color: theme.paletteOf(context).border), ), ), ), diff --git a/lib/widgets/comment_item.dart b/lib/widgets/comment_item.dart index 14d9a5a..7d3cb4c 100644 --- a/lib/widgets/comment_item.dart +++ b/lib/widgets/comment_item.dart @@ -59,7 +59,8 @@ class CommentItem extends StatelessWidget { Text( timeago.format(DateTime.parse(payload['createdAt'])), style: TextStyle( - color: theme.palette.tertiaryText, fontSize: 13), + color: theme.paletteOf(context).tertiaryText, + fontSize: 13), ), ], ), @@ -92,7 +93,8 @@ class CommentItem extends StatelessWidget { SizedBox(width: 4), Text(numberFormat.format(count), style: TextStyle( - color: theme.palette.primary, fontSize: 14)) + color: theme.paletteOf(context).primary, + fontSize: 14)) ], ), ), @@ -120,9 +122,11 @@ class CommentItem extends StatelessWidget { child: Wrap( crossAxisAlignment: WrapCrossAlignment.center, children: [ - Text('+', style: TextStyle(color: theme.palette.primary)), + Text('+', + style: + TextStyle(color: theme.paletteOf(context).primary)), Icon(Octicons.smiley, - color: theme.palette.primary, size: 18), + color: theme.paletteOf(context).primary, size: 18), ], ), ), diff --git a/lib/widgets/entry_item.dart b/lib/widgets/entry_item.dart index 207d82f..dff51b6 100644 --- a/lib/widgets/entry_item.dart +++ b/lib/widgets/entry_item.dart @@ -31,14 +31,14 @@ class EntryItem extends StatelessWidget { style: TextStyle( fontSize: 17, fontWeight: FontWeight.w600, - color: theme.palette.text, + color: theme.paletteOf(context).text, ), ), Text( text, style: TextStyle( fontSize: 14, - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, fontWeight: FontWeight.w500, ), ) diff --git a/lib/widgets/event_item.dart b/lib/widgets/event_item.dart index 481664b..b80846b 100644 --- a/lib/widgets/event_item.dart +++ b/lib/widgets/event_item.dart @@ -19,7 +19,7 @@ class EventItem extends StatelessWidget { final theme = Provider.of(context); return TextSpan( text: text, - style: TextStyle(color: theme.palette.primary), + style: TextStyle(color: theme.paletteOf(context).primary), recognizer: TapGestureRecognizer() ..onTap = () { theme.push(context, url); @@ -62,7 +62,7 @@ class EventItem extends StatelessWidget { text: TextSpan( style: TextStyle( fontSize: 17, - color: theme.palette.text, + color: theme.paletteOf(context).text, ), children: [ _buildLinkSpan( @@ -77,7 +77,7 @@ class EventItem extends StatelessWidget { Text(timeago.format(e.createdAt), style: TextStyle( fontSize: 14, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, )), ], ), @@ -99,7 +99,7 @@ class EventItem extends StatelessWidget { spans: [ TextSpan( text: ' ' + e.type, - style: TextStyle(color: theme.palette.primary), + style: TextStyle(color: theme.paletteOf(context).primary), ) ], card: Text('Woops, ${e.type} not implemented yet'), @@ -114,14 +114,15 @@ class EventItem extends StatelessWidget { child: Container( padding: EdgeInsets.all(12), decoration: BoxDecoration( - color: theme.palette.grayBackground, + color: theme.paletteOf(context).grayBackground, borderRadius: BorderRadius.all(Radius.circular(4))), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ RichText( text: TextSpan( - style: TextStyle(color: theme.palette.text, fontSize: 15), + style: TextStyle( + color: theme.paletteOf(context).text, fontSize: 15), children: [ TextSpan( text: @@ -140,7 +141,7 @@ class EventItem extends StatelessWidget { Text( commit.sha.substring(0, 7), style: TextStyle( - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontSize: 15, fontFamily: CommonStyle.monospace, ), @@ -151,7 +152,8 @@ class EventItem extends StatelessWidget { commit.message, overflow: TextOverflow.ellipsis, maxLines: 1, - style: TextStyle(color: theme.palette.text, fontSize: 15), + style: TextStyle( + color: theme.paletteOf(context).text, fontSize: 15), ), ) ], @@ -190,7 +192,7 @@ class EventItem extends StatelessWidget { child: Container( padding: EdgeInsets.all(12), decoration: BoxDecoration( - color: theme.palette.grayBackground, + color: theme.paletteOf(context).grayBackground, borderRadius: BorderRadius.all(Radius.circular(4))), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -205,7 +207,7 @@ class EventItem extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, fontSize: 17, - color: theme.palette.text, + color: theme.paletteOf(context).text, ), overflow: TextOverflow.ellipsis, ), @@ -217,8 +219,9 @@ class EventItem extends StatelessWidget { body, overflow: TextOverflow.ellipsis, maxLines: 3, - style: - TextStyle(color: theme.palette.secondaryText, fontSize: 15), + style: TextStyle( + color: theme.paletteOf(context).secondaryText, + fontSize: 15), ), Row( children: [ @@ -227,20 +230,20 @@ class EventItem extends StatelessWidget { Text(issue.user.login, style: TextStyle( fontSize: 14, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, )), Expanded(child: Container()), if (issue.comments != null) ...[ Icon( Octicons.comment, size: 14, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, ), SizedBox(width: 4), Text(issue.comments.toString(), style: TextStyle( fontSize: 14, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, )), ] ], diff --git a/lib/widgets/issue_item.dart b/lib/widgets/issue_item.dart index fa44847..a50cf27 100644 --- a/lib/widgets/issue_item.dart +++ b/lib/widgets/issue_item.dart @@ -73,7 +73,7 @@ class IssueItem extends StatelessWidget { TextSpan( text: '#${payload['number']}', style: TextStyle( - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, fontWeight: FontWeight.normal, ), ), @@ -81,7 +81,7 @@ class IssueItem extends StatelessWidget { ), style: TextStyle( fontSize: 17, - color: theme.palette.text, + color: theme.paletteOf(context).text, fontWeight: FontWeight.w600, ), ), @@ -100,7 +100,7 @@ class IssueItem extends StatelessWidget { DefaultTextStyle( style: TextStyle( fontSize: 14, - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -125,7 +125,8 @@ class IssueItem extends StatelessWidget { Expanded(child: SizedBox()), Icon(Octicons.comment, size: 14, - color: theme.palette.secondaryText), + color: + theme.paletteOf(context).secondaryText), SizedBox(width: 3), Text(numberFormat .format(payload['comments']['totalCount'])) diff --git a/lib/widgets/list_group.dart b/lib/widgets/list_group.dart index 70011a6..c0a7962 100644 --- a/lib/widgets/list_group.dart +++ b/lib/widgets/list_group.dart @@ -20,7 +20,7 @@ class ListGroup extends StatelessWidget { final theme = Provider.of(context); return Container( decoration: BoxDecoration( - border: Border(top: BorderSide(color: theme.palette.border)), + border: Border(top: BorderSide(color: theme.paletteOf(context).border)), ), child: itemBuilder(entry.value, entry.key), ); @@ -33,7 +33,7 @@ class ListGroup extends StatelessWidget { padding: padding, child: Container( decoration: BoxDecoration( - border: Border.all(color: theme.palette.border), + border: Border.all(color: theme.paletteOf(context).border), borderRadius: BorderRadius.all(Radius.circular(3)), ), child: Column( diff --git a/lib/widgets/markdown_view.dart b/lib/widgets/markdown_view.dart index cf5dae2..0cde890 100644 --- a/lib/widgets/markdown_view.dart +++ b/lib/widgets/markdown_view.dart @@ -20,8 +20,8 @@ class MarkdownView extends StatelessWidget { @override Widget build(BuildContext context) { final theme = Provider.of(context); - final _basicStyle = - TextStyle(fontSize: 16, color: theme.palette.text, height: 1.5); + final _basicStyle = TextStyle( + fontSize: 16, color: theme.paletteOf(context).text, height: 1.5); final _hStyle = _basicStyle.copyWith(fontWeight: FontWeight.w600, height: 1.25); @@ -69,7 +69,7 @@ class MarkdownView extends StatelessWidget { }, data: text, styleSheet: MarkdownStyleSheet( - a: _basicStyle.copyWith(color: theme.palette.primary), + a: _basicStyle.copyWith(color: theme.paletteOf(context).primary), p: _basicStyle, code: _basicStyle.copyWith( fontSize: 16 * 0.85, @@ -82,11 +82,12 @@ class MarkdownView extends StatelessWidget { h4: _hStyle, h5: _hStyle.copyWith(fontSize: 14), h6: _hStyle.copyWith( - fontSize: 16 * 0.85, color: theme.palette.tertiaryText), + fontSize: 16 * 0.85, color: theme.paletteOf(context).tertiaryText), em: _basicStyle.copyWith(fontStyle: FontStyle.italic), strong: _basicStyle.copyWith(fontWeight: FontWeight.w600), del: const TextStyle(decoration: TextDecoration.lineThrough), - blockquote: _basicStyle.copyWith(color: theme.palette.tertiaryText), + blockquote: + _basicStyle.copyWith(color: theme.paletteOf(context).tertiaryText), img: _basicStyle, checkbox: _basicStyle, blockSpacing: 16, @@ -104,14 +105,14 @@ class MarkdownView extends StatelessWidget { ), codeblockPadding: EdgeInsets.all(16), codeblockDecoration: BoxDecoration( - color: theme.palette.grayBackground, + color: theme.paletteOf(context).grayBackground, borderRadius: BorderRadius.circular(3), ), horizontalRuleDecoration: BoxDecoration( border: Border( top: BorderSide( width: 4, - color: theme.palette.grayBackground, + color: theme.paletteOf(context).grayBackground, ), ), ), diff --git a/lib/widgets/mutation_button.dart b/lib/widgets/mutation_button.dart index 0fddabd..8e011b7 100644 --- a/lib/widgets/mutation_button.dart +++ b/lib/widgets/mutation_button.dart @@ -17,7 +17,7 @@ class MutationButton extends StatelessWidget { return CupertinoButton( onPressed: onPressed, minSize: 0, - color: theme.palette.primary, + color: theme.paletteOf(context).primary, padding: EdgeInsets.symmetric( horizontal: 14, vertical: 5, @@ -27,7 +27,7 @@ class MutationButton extends StatelessWidget { text, style: TextStyle( fontSize: 18, - color: theme.palette.background, + color: theme.paletteOf(context).background, ), ), ); diff --git a/lib/widgets/notification_item.dart b/lib/widgets/notification_item.dart index eeed269..8b35d7d 100644 --- a/lib/widgets/notification_item.dart +++ b/lib/widgets/notification_item.dart @@ -71,8 +71,9 @@ class _NotificationItemState extends State { final theme = Provider.of(context); return Icon( payload.unread ? Octicons.check : Octicons.primitive_dot, - color: - loading ? theme.palette.grayBackground : theme.palette.tertiaryText, + color: loading + ? theme.paletteOf(context).grayBackground + : theme.paletteOf(context).tertiaryText, size: 24, ); } @@ -133,7 +134,8 @@ class _NotificationItemState extends State { child: Text( payload.subject.title, overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 15, color: theme.palette.text), + style: TextStyle( + fontSize: 15, color: theme.paletteOf(context).text), ), ), Link(child: _buildCheckIcon(), onTap: _markAsRead), diff --git a/lib/widgets/repository_item.dart b/lib/widgets/repository_item.dart index f9b8b0d..39c0798 100644 --- a/lib/widgets/repository_item.dart +++ b/lib/widgets/repository_item.dart @@ -79,14 +79,14 @@ class RepositoryItem extends StatelessWidget { owner + ' / ', style: TextStyle( fontSize: 18, - color: theme.palette.primary, + color: theme.paletteOf(context).primary, ), ), Text( name, style: TextStyle( fontSize: 18, - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontWeight: FontWeight.w600, ), overflow: TextOverflow.ellipsis, @@ -97,8 +97,10 @@ class RepositoryItem extends StatelessWidget { SizedBox(width: 6), DefaultTextStyle( child: Icon(iconData, - size: 16, color: theme.palette.secondaryText), - style: TextStyle(color: theme.palette.secondaryText), + size: 16, + color: theme.paletteOf(context).secondaryText), + style: TextStyle( + color: theme.paletteOf(context).secondaryText), ), ] ], @@ -108,7 +110,7 @@ class RepositoryItem extends StatelessWidget { Text( description, style: TextStyle( - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, fontSize: 16, ), ), @@ -119,13 +121,14 @@ class RepositoryItem extends StatelessWidget { note, style: TextStyle( fontSize: 14, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, ), ), SizedBox(height: 10), ], DefaultTextStyle( - style: TextStyle(color: theme.palette.text, fontSize: 14), + style: TextStyle( + color: theme.paletteOf(context).text, fontSize: 14), child: Row( children: [ if (primaryLanguageName != null) ...[ @@ -146,14 +149,14 @@ class RepositoryItem extends StatelessWidget { ], if (starCount > 0) ...[ Icon(Octicons.star, - size: 16, color: theme.palette.text), + size: 16, color: theme.paletteOf(context).text), SizedBox(width: 2), Text(numberFormat.format(starCount)), SizedBox(width: 24), ], if (forkCount > 0) ...[ Icon(Octicons.repo_forked, - size: 16, color: theme.palette.text), + size: 16, color: theme.paletteOf(context).text), SizedBox(width: 2), Text(numberFormat.format(forkCount)), ], diff --git a/lib/widgets/table_view.dart b/lib/widgets/table_view.dart index 9661c45..e786c02 100644 --- a/lib/widgets/table_view.dart +++ b/lib/widgets/table_view.dart @@ -18,7 +18,8 @@ class TableViewHeader extends StatelessWidget { padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6), child: Text( title.toUpperCase(), - style: TextStyle(color: theme.palette.secondaryText, fontSize: 13), + style: TextStyle( + color: theme.paletteOf(context).secondaryText, fontSize: 13), ), ); } @@ -71,7 +72,7 @@ class TableView extends StatelessWidget { if (leftWidget == null && hasIcon) { leftWidget = Icon( item.leftIconData, - color: theme.palette.primary, + color: theme.paletteOf(context).primary, size: 20, ); } @@ -80,7 +81,8 @@ class TableView extends StatelessWidget { onTap: item.onTap, url: item.url, child: DefaultTextStyle( - style: TextStyle(fontSize: 17, color: theme.palette.text), + style: TextStyle( + fontSize: 17, color: theme.paletteOf(context).text), overflow: TextOverflow.ellipsis, child: Container( height: 44, @@ -95,7 +97,7 @@ class TableView extends StatelessWidget { DefaultTextStyle( style: TextStyle( fontSize: 16, - color: theme.palette.tertiaryText, + color: theme.paletteOf(context).tertiaryText, ), child: item.rightWidget, ), @@ -104,7 +106,8 @@ class TableView extends StatelessWidget { if ((item.onTap != null || item.url != null) && !item.hideRightChevron) Icon(CupertinoIcons.right_chevron, - size: 20, color: theme.palette.tertiaryText) + size: 20, + color: theme.paletteOf(context).tertiaryText) else SizedBox(width: 2), SizedBox(width: 8), diff --git a/lib/widgets/timeline_item.dart b/lib/widgets/timeline_item.dart index 0ebb8f1..63ce09f 100644 --- a/lib/widgets/timeline_item.dart +++ b/lib/widgets/timeline_item.dart @@ -34,7 +34,8 @@ class TimelineEventItem extends StatelessWidget { Expanded( child: RichText( text: TextSpan( - style: TextStyle(color: theme.palette.text, fontSize: 16), + style: + TextStyle(color: theme.paletteOf(context).text, fontSize: 16), children: [ // TODO: actor is null createUserSpan(context, actor), @@ -287,12 +288,12 @@ class TimelineItem extends StatelessWidget { TextSpan(text: ' branch from '), TextSpan( text: (p['beforeCommit']['oid'] as String).substring(0, 7), - style: TextStyle(color: theme.palette.primary), + style: TextStyle(color: theme.paletteOf(context).primary), ), TextSpan(text: ' to '), TextSpan( text: (p['afterCommit']['oid'] as String).substring(0, 7), - style: TextStyle(color: theme.palette.primary), + style: TextStyle(color: theme.paletteOf(context).primary), ), ], ), diff --git a/lib/widgets/user_item.dart b/lib/widgets/user_item.dart index 41f0c8e..85cb6af 100644 --- a/lib/widgets/user_item.dart +++ b/lib/widgets/user_item.dart @@ -46,7 +46,7 @@ class UserItem extends StatelessWidget { // Text( // name ?? login, // style: TextStyle( - // color: theme.palette.text, + // color: theme.paletteOf(context).text, // fontSize: 18, // ), // ), @@ -54,7 +54,7 @@ class UserItem extends StatelessWidget { Text( login, style: TextStyle( - color: theme.palette.primary, + color: theme.paletteOf(context).primary, fontSize: 18, // fontWeight: FontWeight.w600, ), @@ -65,7 +65,7 @@ class UserItem extends StatelessWidget { if (bio != null) DefaultTextStyle( style: TextStyle( - color: theme.palette.secondaryText, + color: theme.paletteOf(context).secondaryText, fontSize: 15, ), child: bio,