diff --git a/lib/app.dart b/lib/app.dart index 3335733..077549d 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -20,8 +20,8 @@ class MyApp extends StatelessWidget { brightness: theme.brightness, primaryColor: theme.brightness == Brightness.dark ? null : Colors.white, - accentColor: theme.paletteOf(context).primary, - scaffoldBackgroundColor: theme.paletteOf(context).background, + accentColor: theme.palette.primary, + scaffoldBackgroundColor: theme.palette.background, ), home: Home(), ); diff --git a/lib/home.dart b/lib/home.dart index 36c27dd..3185885 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -72,7 +72,7 @@ class _HomeState extends State { right: -2, top: -2, child: Icon(Octicons.primitive_dot, - color: theme.paletteOf(context).primary, size: 14)) + color: theme.palette.primary, size: 14)) ], ); } @@ -141,7 +141,7 @@ class _HomeState extends State { return Scaffold( body: _buildScreen(active), bottomNavigationBar: BottomNavigationBar( - selectedItemColor: theme.paletteOf(context).primary, + selectedItemColor: theme.palette.primary, items: _navigationItems, currentIndex: active, type: BottomNavigationBarType.fixed, diff --git a/lib/models/theme.dart b/lib/models/theme.dart index 4885b95..ba42a8b 100644 --- a/lib/models/theme.dart +++ b/lib/models/theme.dart @@ -157,14 +157,13 @@ class ThemeModel with ChangeNotifier { border: Colors.grey.shade700, ); - Palette paletteOf(BuildContext context) { + Palette get palette { switch (brightness) { - case Brightness.light: - return paletteLight; case Brightness.dark: return paletteDark; + case Brightness.light: default: - throw 'brightnessOf should not return null'; + return paletteLight; } } @@ -364,7 +363,7 @@ class ThemeModel with ChangeNotifier { return Container( height: 216, child: CupertinoPicker( - backgroundColor: paletteOf(context).background, + backgroundColor: palette.background, children: groupItem.items.map((v) => Text(v.text)).toList(), itemExtent: 40, scrollController: FixedExtentScrollController( diff --git a/lib/scaffolds/long_list.dart b/lib/scaffolds/long_list.dart index 0aa16f1..bee6b14 100644 --- a/lib/scaffolds/long_list.dart +++ b/lib/scaffolds/long_list.dart @@ -134,21 +134,20 @@ class _LongListStatefulScaffoldState child: Container( padding: CommonStyle.padding, decoration: BoxDecoration( - border: Border.all(color: theme.paletteOf(context).text), + border: Border.all(color: theme.palette.text), ), child: Column( children: [ Text('$count hidden items', - style: TextStyle( - color: theme.paletteOf(context).text, fontSize: 15)), + style: + TextStyle(color: theme.palette.text, fontSize: 15)), Padding(padding: EdgeInsets.only(top: 4)), loadingMore ? CupertinoActivityIndicator() : Text( 'Load more...', style: TextStyle( - color: theme.paletteOf(context).primary, - fontSize: 16), + color: theme.palette.primary, fontSize: 16), ), ], ), diff --git a/lib/screens/about.dart b/lib/screens/about.dart index 696dbbc..dc7c581 100644 --- a/lib/screens/about.dart +++ b/lib/screens/about.dart @@ -51,8 +51,7 @@ class _AboutScreenState extends State { SizedBox(height: 12), Text( 'GitTouch', - style: - TextStyle(fontSize: 20, color: theme.paletteOf(context).text), + style: TextStyle(fontSize: 20, color: theme.palette.text), ), SizedBox(height: 48), TableView(items: [ diff --git a/lib/screens/commits.dart b/lib/screens/commits.dart index b1614b3..8879919 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.paletteOf(context).text, + color: theme.palette.text, ), overflow: TextOverflow.ellipsis, ), @@ -93,7 +93,7 @@ class CommitsScreen extends StatelessWidget { Text( ' committed ${timeago.format(payload.committedDate)}', style: TextStyle( - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontSize: 15, ), ), diff --git a/lib/screens/gitlab_project.dart b/lib/screens/gitlab_project.dart index e77ea29..e9b4791 100644 --- a/lib/screens/gitlab_project.dart +++ b/lib/screens/gitlab_project.dart @@ -84,7 +84,7 @@ class GitlabProjectScreen extends StatelessWidget { CommonStyle.verticalGap, if (data.languages.isNotEmpty) Container( - color: theme.paletteOf(context).background, + color: theme.palette.background, padding: CommonStyle.padding.copyWith(top: 8, bottom: 8), child: ClipRRect( borderRadius: BorderRadius.circular(2), @@ -131,7 +131,7 @@ class GitlabProjectScreen extends StatelessWidget { if (data.readme != null) Container( padding: CommonStyle.padding, - color: theme.paletteOf(context).background, + color: theme.palette.background, child: MarkdownView(data.readme), ), CommonStyle.verticalGap, diff --git a/lib/screens/gitlab_project_activity.dart b/lib/screens/gitlab_project_activity.dart index d411aa4..536f1c3 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.paletteOf(context).primary, + color: theme.palette.primary, fontWeight: FontWeight.w500, ), ), diff --git a/lib/screens/gitlab_todos.dart b/lib/screens/gitlab_todos.dart index e392054..b7d6f3d 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.paletteOf(context).primary), + style: TextStyle(color: theme.palette.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.paletteOf(context).primary), + style: TextStyle(color: theme.palette.primary), ); } @@ -85,8 +85,7 @@ class GitlabTodosScreen extends StatelessWidget { child: Text.rich( TextSpan( style: TextStyle( - color: theme.paletteOf(context).text, - fontSize: 17), + color: theme.palette.text, fontSize: 17), children: [ ..._buildItem(context, item), ], diff --git a/lib/screens/image_view.dart b/lib/screens/image_view.dart index 792a2a1..7b290f6 100644 --- a/lib/screens/image_view.dart +++ b/lib/screens/image_view.dart @@ -18,8 +18,7 @@ class ImageViewScreen extends StatelessWidget { title: title, body: PhotoView( imageProvider: NetworkImage(url), - backgroundDecoration: - BoxDecoration(color: theme.paletteOf(context).background), + backgroundDecoration: BoxDecoration(color: theme.palette.background), ), ); } diff --git a/lib/screens/issue.dart b/lib/screens/issue.dart index 9cbe319..4d195e6 100644 --- a/lib/screens/issue.dart +++ b/lib/screens/issue.dart @@ -427,7 +427,7 @@ mutation { '$owner / $name', style: TextStyle( fontSize: 17, - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, ), ), SizedBox(width: 4), @@ -435,7 +435,7 @@ mutation { '#$number', style: TextStyle( fontSize: 17, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, ), ), ], @@ -462,7 +462,7 @@ mutation { Text( '${p['changedFiles']} files changed', style: TextStyle( - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontSize: 17, ), ), @@ -485,7 +485,7 @@ mutation { ), Icon( Icons.chevron_right, - color: theme.paletteOf(context).border, + color: theme.palette.border, ), ], ) diff --git a/lib/screens/login.dart b/lib/screens/login.dart index ba51df3..165fc9d 100644 --- a/lib/screens/login.dart +++ b/lib/screens/login.dart @@ -39,8 +39,7 @@ class _LoginScreenState extends State { child: Container( padding: CommonStyle.padding, decoration: BoxDecoration( - border: Border( - bottom: BorderSide(color: theme.paletteOf(context).border)), + border: Border(bottom: BorderSide(color: theme.palette.border)), ), child: Row( children: [ @@ -72,8 +71,7 @@ class _LoginScreenState extends State { child: Container( padding: EdgeInsets.symmetric(vertical: 20), decoration: BoxDecoration( - border: Border( - bottom: BorderSide(color: theme.paletteOf(context).border)), + border: Border(bottom: BorderSide(color: theme.palette.border)), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -130,8 +128,7 @@ class _LoginScreenState extends State { Text( 'user, repo, read:org, notifications', style: TextStyle( - fontSize: 16, - color: theme.paletteOf(context).primary), + fontSize: 16, color: theme.palette.primary), ) ], ), @@ -181,7 +178,7 @@ class _LoginScreenState extends State { // Text( // 'api, read_user, read_repository', // style: TextStyle( - // fontSize: 16, color: theme.paletteOf(context).primary), + // fontSize: 16, color: theme.palette.primary), // ) // ], // ), diff --git a/lib/screens/notification.dart b/lib/screens/notification.dart index 5193c15..54ab6cf 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.paletteOf(context).text, + color: theme.palette.text, ), ), GestureDetector( @@ -125,7 +125,7 @@ ${item.key}: pullRequest(number: ${item.subject.number}) { }, child: Icon( Octicons.check, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, size: 24, ), ), diff --git a/lib/screens/object.dart b/lib/screens/object.dart index 501658a..a74d8f1 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.paletteOf(context).background), + BoxDecoration(color: theme.palette.background), ); case 'md': case 'markdown': diff --git a/lib/screens/repository.dart b/lib/screens/repository.dart index 18c6cfb..6077743 100644 --- a/lib/screens/repository.dart +++ b/lib/screens/repository.dart @@ -62,7 +62,7 @@ class RepositoryScreen extends StatelessWidget { Widget _buildLanguages(BuildContext context, GhRepoRepository repo) { final theme = Provider.of(context); return Container( - color: theme.paletteOf(context).background, + color: theme.palette.background, padding: CommonStyle.padding, height: 300, child: SingleChildScrollView( @@ -84,7 +84,7 @@ class RepositoryScreen extends StatelessWidget { Text( edge.node.name, style: TextStyle( - color: theme.paletteOf(context).text, + color: theme.palette.text, fontSize: 18, ), ), @@ -95,7 +95,7 @@ class RepositoryScreen extends StatelessWidget { child: Text( '${(edge.size / repo.languages.totalSize * 100).toStringAsFixed(1)}%', style: TextStyle( - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontSize: 18, ), ), @@ -170,7 +170,7 @@ class RepositoryScreen extends StatelessWidget { '$owner / $name', style: TextStyle( fontSize: 20, - color: theme.paletteOf(context).primary, + color: theme.palette.primary, ), ), ], @@ -250,7 +250,7 @@ class RepositoryScreen extends StatelessWidget { Text( repo.description, style: TextStyle( - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontSize: 17, ), ), @@ -260,7 +260,7 @@ class RepositoryScreen extends StatelessWidget { child: Text( repo.homepageUrl, style: TextStyle( - color: theme.paletteOf(context).primary, + color: theme.palette.primary, fontSize: 17, ), ), @@ -274,8 +274,8 @@ class RepositoryScreen extends StatelessWidget { return MyLabel( name: node.topic.name, // color: Colors.blue.shade50, - color: theme.paletteOf(context).grayBackground, - textColor: theme.paletteOf(context).primary, + color: theme.palette.grayBackground, + textColor: theme.palette.primary, ); }).toList(), ) @@ -314,7 +314,7 @@ class RepositoryScreen extends StatelessWidget { ); }, child: Container( - // color: theme.paletteOf(context).background, + // color: theme.palette.background, padding: CommonStyle.padding.copyWith(top: 8, bottom: 8), child: ClipRRect( borderRadius: BorderRadius.circular(5), @@ -410,7 +410,7 @@ class RepositoryScreen extends StatelessWidget { if (readme != null) Container( padding: CommonStyle.padding, - color: theme.paletteOf(context).background, + color: theme.palette.background, child: MarkdownView( readme, basePaths: [owner, name, branch ?? 'master'], // TODO: diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 9fb605c..238f91d 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -39,7 +39,7 @@ class _SettingsScreenState extends State { Widget _buildRightWidget(BuildContext context, bool checked) { final theme = Provider.of(context); if (!checked) return null; - return Icon(Icons.check, color: theme.paletteOf(context).primary, size: 24); + return Icon(Icons.check, color: theme.palette.primary, size: 24); } @override diff --git a/lib/screens/trending.dart b/lib/screens/trending.dart index d45f8ad..dbb72cc 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.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, ), SizedBox(width: 2), Text(item.repo.name) diff --git a/lib/screens/user.dart b/lib/screens/user.dart index 90cc474..2365508 100644 --- a/lib/screens/user.dart +++ b/lib/screens/user.dart @@ -108,7 +108,7 @@ class UserScreen extends StatelessWidget { Text( name, style: TextStyle( - color: theme.paletteOf(context).text, + color: theme.palette.text, fontSize: 20, fontWeight: FontWeight.w600, ), @@ -118,7 +118,7 @@ class UserScreen extends StatelessWidget { Text( login, style: TextStyle( - color: theme.paletteOf(context).primary, + color: theme.palette.primary, fontSize: 18, ), ), @@ -128,13 +128,13 @@ class UserScreen extends StatelessWidget { Icon( Octicons.clock, size: 16, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, ), SizedBox(width: 4), Text( 'Joined on ${dateFormat.format(createdAt)}', style: TextStyle( - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, fontSize: 16, ), ), @@ -145,7 +145,7 @@ class UserScreen extends StatelessWidget { Text( bio, style: TextStyle( - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontSize: 17, ), ) @@ -256,8 +256,7 @@ class UserScreen extends StatelessWidget { leftIconData: Octicons.organization, text: TextContainsOrganization( p.company, - style: TextStyle( - fontSize: 17, color: theme.paletteOf(context).text), + style: TextStyle(fontSize: 17, color: theme.palette.text), oneLine: true, ), ), diff --git a/lib/screens/users.dart b/lib/screens/users.dart index f4962e7..63c7aef 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.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, ), SizedBox(width: 4), Text(company), @@ -117,7 +117,7 @@ class UsersScreen extends StatelessWidget { Icon( Octicons.location, size: 15, - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, ), SizedBox(width: 4), Text(location), @@ -129,7 +129,7 @@ class UsersScreen extends StatelessWidget { Icon( Octicons.clock, size: 15, - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, ), SizedBox(width: 4), Text('Joined on ${dateFormat.format(createdAt)}'), diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index f20191d..14ff6c4 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -66,7 +66,7 @@ TextSpan createLinkSpan( return TextSpan( text: text, style: TextStyle( - color: theme.paletteOf(context).primary, + color: theme.palette.primary, fontWeight: FontWeight.w600, ), recognizer: TapGestureRecognizer() @@ -160,7 +160,7 @@ class PrimerBranchName extends StatelessWidget { child: Text( name, style: TextStyle( - color: theme.paletteOf(context).primary, + color: theme.palette.primary, fontSize: 14, height: 1, fontFamily: CommonStyle.monospace, diff --git a/lib/widgets/blob_view.dart b/lib/widgets/blob_view.dart index f03114a..e1c45fc 100644 --- a/lib/widgets/blob_view.dart +++ b/lib/widgets/blob_view.dart @@ -39,8 +39,7 @@ class BlobView extends StatelessWidget { case 'webp': return PhotoView( imageProvider: NetworkImage(payload), - backgroundDecoration: - BoxDecoration(color: theme.paletteOf(context).background), + backgroundDecoration: BoxDecoration(color: theme.palette.background), ); case 'md': case 'markdown': diff --git a/lib/widgets/border_view.dart b/lib/widgets/border_view.dart index 5deea5c..b9cbb72 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.paletteOf(context).border, width: 0), + top: BorderSide(color: theme.palette.border, width: 0), ), ), ); @@ -33,15 +33,14 @@ class BorderView extends StatelessWidget { width: leftPadding, height: height, child: DecoratedBox( - decoration: - BoxDecoration(color: theme.paletteOf(context).background), + decoration: BoxDecoration(color: theme.palette.background), ), ), Expanded( child: SizedBox( height: height, child: DecoratedBox( - decoration: BoxDecoration(color: theme.paletteOf(context).border), + decoration: BoxDecoration(color: theme.palette.border), ), ), ), diff --git a/lib/widgets/comment_item.dart b/lib/widgets/comment_item.dart index 7d3cb4c..14d9a5a 100644 --- a/lib/widgets/comment_item.dart +++ b/lib/widgets/comment_item.dart @@ -59,8 +59,7 @@ class CommentItem extends StatelessWidget { Text( timeago.format(DateTime.parse(payload['createdAt'])), style: TextStyle( - color: theme.paletteOf(context).tertiaryText, - fontSize: 13), + color: theme.palette.tertiaryText, fontSize: 13), ), ], ), @@ -93,8 +92,7 @@ class CommentItem extends StatelessWidget { SizedBox(width: 4), Text(numberFormat.format(count), style: TextStyle( - color: theme.paletteOf(context).primary, - fontSize: 14)) + color: theme.palette.primary, fontSize: 14)) ], ), ), @@ -122,11 +120,9 @@ class CommentItem extends StatelessWidget { child: Wrap( crossAxisAlignment: WrapCrossAlignment.center, children: [ - Text('+', - style: - TextStyle(color: theme.paletteOf(context).primary)), + Text('+', style: TextStyle(color: theme.palette.primary)), Icon(Octicons.smiley, - color: theme.paletteOf(context).primary, size: 18), + color: theme.palette.primary, size: 18), ], ), ), diff --git a/lib/widgets/entry_item.dart b/lib/widgets/entry_item.dart index dff51b6..207d82f 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.paletteOf(context).text, + color: theme.palette.text, ), ), Text( text, style: TextStyle( fontSize: 14, - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontWeight: FontWeight.w500, ), ) diff --git a/lib/widgets/event_item.dart b/lib/widgets/event_item.dart index 4f65cbc..3292c9b 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.paletteOf(context).primary), + style: TextStyle(color: theme.palette.primary), recognizer: TapGestureRecognizer() ..onTap = () { theme.push(context, url); @@ -62,7 +62,7 @@ class EventItem extends StatelessWidget { TextSpan( style: TextStyle( fontSize: 17, - color: theme.paletteOf(context).text, + color: theme.palette.text, ), children: [ _buildLinkSpan( @@ -77,7 +77,7 @@ class EventItem extends StatelessWidget { Text(timeago.format(e.createdAt), style: TextStyle( fontSize: 14, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, )), ], ), @@ -99,7 +99,7 @@ class EventItem extends StatelessWidget { spans: [ TextSpan( text: ' ' + e.type, - style: TextStyle(color: theme.paletteOf(context).primary), + style: TextStyle(color: theme.palette.primary), ) ], card: Text('Woops, ${e.type} not implemented yet'), @@ -114,15 +114,14 @@ class EventItem extends StatelessWidget { child: Container( padding: EdgeInsets.all(12), decoration: BoxDecoration( - color: theme.paletteOf(context).grayBackground, + color: theme.palette.grayBackground, borderRadius: BorderRadius.all(Radius.circular(4))), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text.rich( TextSpan( - style: TextStyle( - color: theme.paletteOf(context).text, fontSize: 15), + style: TextStyle(color: theme.palette.text, fontSize: 15), children: [ TextSpan( text: @@ -141,7 +140,7 @@ class EventItem extends StatelessWidget { Text( commit.sha.substring(0, 7), style: TextStyle( - color: theme.paletteOf(context).primary, + color: theme.palette.primary, fontSize: 15, fontFamily: CommonStyle.monospace, ), @@ -152,8 +151,7 @@ class EventItem extends StatelessWidget { commit.message, overflow: TextOverflow.ellipsis, maxLines: 1, - style: TextStyle( - color: theme.paletteOf(context).text, fontSize: 15), + style: TextStyle(color: theme.palette.text, fontSize: 15), ), ) ], @@ -192,7 +190,7 @@ class EventItem extends StatelessWidget { child: Container( padding: EdgeInsets.all(12), decoration: BoxDecoration( - color: theme.paletteOf(context).grayBackground, + color: theme.palette.grayBackground, borderRadius: BorderRadius.all(Radius.circular(4))), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -207,7 +205,7 @@ class EventItem extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, fontSize: 17, - color: theme.paletteOf(context).text, + color: theme.palette.text, ), overflow: TextOverflow.ellipsis, ), @@ -219,9 +217,8 @@ class EventItem extends StatelessWidget { body, overflow: TextOverflow.ellipsis, maxLines: 3, - style: TextStyle( - color: theme.paletteOf(context).secondaryText, - fontSize: 15), + style: + TextStyle(color: theme.palette.secondaryText, fontSize: 15), ), Row( children: [ @@ -230,20 +227,20 @@ class EventItem extends StatelessWidget { Text(issue.user.login, style: TextStyle( fontSize: 14, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, )), Expanded(child: Container()), if (issue.comments != null) ...[ Icon( Octicons.comment, size: 14, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, ), SizedBox(width: 4), Text(issue.comments.toString(), style: TextStyle( fontSize: 14, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, )), ] ], diff --git a/lib/widgets/issue_item.dart b/lib/widgets/issue_item.dart index a50cf27..fa44847 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.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, fontWeight: FontWeight.normal, ), ), @@ -81,7 +81,7 @@ class IssueItem extends StatelessWidget { ), style: TextStyle( fontSize: 17, - color: theme.paletteOf(context).text, + color: theme.palette.text, fontWeight: FontWeight.w600, ), ), @@ -100,7 +100,7 @@ class IssueItem extends StatelessWidget { DefaultTextStyle( style: TextStyle( fontSize: 14, - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -125,8 +125,7 @@ class IssueItem extends StatelessWidget { Expanded(child: SizedBox()), Icon(Octicons.comment, size: 14, - color: - theme.paletteOf(context).secondaryText), + color: theme.palette.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 c0a7962..70011a6 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.paletteOf(context).border)), + border: Border(top: BorderSide(color: theme.palette.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.paletteOf(context).border), + border: Border.all(color: theme.palette.border), borderRadius: BorderRadius.all(Radius.circular(3)), ), child: Column( diff --git a/lib/widgets/markdown_view.dart b/lib/widgets/markdown_view.dart index 806c005..2dc7d33 100644 --- a/lib/widgets/markdown_view.dart +++ b/lib/widgets/markdown_view.dart @@ -22,8 +22,8 @@ class MarkdownView extends StatelessWidget { Widget build(BuildContext context) { final theme = Provider.of(context); final code = Provider.of(context); - final _basicStyle = TextStyle( - fontSize: 16, color: theme.paletteOf(context).text, height: 1.5); + final _basicStyle = + TextStyle(fontSize: 16, color: theme.palette.text, height: 1.5); final _hStyle = _basicStyle.copyWith(fontWeight: FontWeight.w600, height: 1.25); @@ -71,7 +71,7 @@ class MarkdownView extends StatelessWidget { }, data: text, styleSheet: MarkdownStyleSheet( - a: _basicStyle.copyWith(color: theme.paletteOf(context).primary), + a: _basicStyle.copyWith(color: theme.palette.primary), p: _basicStyle, code: _basicStyle.copyWith( fontSize: 16 * 0.85, @@ -84,12 +84,11 @@ class MarkdownView extends StatelessWidget { h4: _hStyle, h5: _hStyle.copyWith(fontSize: 14), h6: _hStyle.copyWith( - fontSize: 16 * 0.85, color: theme.paletteOf(context).tertiaryText), + fontSize: 16 * 0.85, color: theme.palette.tertiaryText), em: _basicStyle.copyWith(fontStyle: FontStyle.italic), strong: _basicStyle.copyWith(fontWeight: FontWeight.w600), del: const TextStyle(decoration: TextDecoration.lineThrough), - blockquote: - _basicStyle.copyWith(color: theme.paletteOf(context).tertiaryText), + blockquote: _basicStyle.copyWith(color: theme.palette.tertiaryText), img: _basicStyle, checkbox: _basicStyle, blockSpacing: 16, @@ -107,14 +106,14 @@ class MarkdownView extends StatelessWidget { ), codeblockPadding: EdgeInsets.all(16), codeblockDecoration: BoxDecoration( - color: theme.paletteOf(context).grayBackground, + color: theme.palette.grayBackground, borderRadius: BorderRadius.circular(3), ), horizontalRuleDecoration: BoxDecoration( border: Border( top: BorderSide( width: 4, - color: theme.paletteOf(context).grayBackground, + color: theme.palette.grayBackground, ), ), ), diff --git a/lib/widgets/mutation_button.dart b/lib/widgets/mutation_button.dart index 655cf17..1fda9bb 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.paletteOf(context).primary, + color: theme.palette.primary, padding: EdgeInsets.symmetric( horizontal: 12, vertical: 4, @@ -27,7 +27,7 @@ class MutationButton extends StatelessWidget { text, style: TextStyle( fontSize: 17, - color: theme.paletteOf(context).background, + color: theme.palette.background, ), ), ); diff --git a/lib/widgets/notification_item.dart b/lib/widgets/notification_item.dart index 8b35d7d..eeed269 100644 --- a/lib/widgets/notification_item.dart +++ b/lib/widgets/notification_item.dart @@ -71,9 +71,8 @@ class _NotificationItemState extends State { final theme = Provider.of(context); return Icon( payload.unread ? Octicons.check : Octicons.primitive_dot, - color: loading - ? theme.paletteOf(context).grayBackground - : theme.paletteOf(context).tertiaryText, + color: + loading ? theme.palette.grayBackground : theme.palette.tertiaryText, size: 24, ); } @@ -134,8 +133,7 @@ class _NotificationItemState extends State { child: Text( payload.subject.title, overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 15, color: theme.paletteOf(context).text), + style: TextStyle(fontSize: 15, color: theme.palette.text), ), ), Link(child: _buildCheckIcon(), onTap: _markAsRead), diff --git a/lib/widgets/repository_item.dart b/lib/widgets/repository_item.dart index aea2593..cb10f14 100644 --- a/lib/widgets/repository_item.dart +++ b/lib/widgets/repository_item.dart @@ -80,14 +80,14 @@ class RepositoryItem extends StatelessWidget { text: '$owner / ', style: TextStyle( fontSize: 18, - color: theme.paletteOf(context).primary, + color: theme.palette.primary, ), ), TextSpan( text: name, style: TextStyle( fontSize: 18, - color: theme.paletteOf(context).primary, + color: theme.palette.primary, fontWeight: FontWeight.w600, ), // overflow: TextOverflow.ellipsis, @@ -100,10 +100,8 @@ class RepositoryItem extends StatelessWidget { SizedBox(width: 6), DefaultTextStyle( child: Icon(iconData, - size: 18, - color: theme.paletteOf(context).secondaryText), - style: TextStyle( - color: theme.paletteOf(context).secondaryText), + size: 18, color: theme.palette.secondaryText), + style: TextStyle(color: theme.palette.secondaryText), ), ] ], @@ -113,7 +111,7 @@ class RepositoryItem extends StatelessWidget { Text( description, style: TextStyle( - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontSize: 16, ), ), @@ -124,14 +122,13 @@ class RepositoryItem extends StatelessWidget { note, style: TextStyle( fontSize: 14, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, ), ), SizedBox(height: 10), ], DefaultTextStyle( - style: TextStyle( - color: theme.paletteOf(context).text, fontSize: 14), + style: TextStyle(color: theme.palette.text, fontSize: 14), child: Row( children: [ if (primaryLanguageName != null) ...[ @@ -152,14 +149,14 @@ class RepositoryItem extends StatelessWidget { ], if (starCount > 0) ...[ Icon(Octicons.star, - size: 16, color: theme.paletteOf(context).text), + size: 16, color: theme.palette.text), SizedBox(width: 2), Text(numberFormat.format(starCount)), SizedBox(width: 24), ], if (forkCount > 0) ...[ Icon(Octicons.repo_forked, - size: 16, color: theme.paletteOf(context).text), + size: 16, color: theme.palette.text), SizedBox(width: 2), Text(numberFormat.format(forkCount)), ], diff --git a/lib/widgets/table_view.dart b/lib/widgets/table_view.dart index 6ac7bab..b87ae1e 100644 --- a/lib/widgets/table_view.dart +++ b/lib/widgets/table_view.dart @@ -18,8 +18,7 @@ class TableViewHeader extends StatelessWidget { padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6), child: Text( title.toUpperCase(), - style: TextStyle( - color: theme.paletteOf(context).secondaryText, fontSize: 13), + style: TextStyle(color: theme.palette.secondaryText, fontSize: 13), ), ); } @@ -72,7 +71,7 @@ class TableView extends StatelessWidget { if (leftWidget == null && hasIcon) { leftWidget = Icon( item.leftIconData, - color: theme.paletteOf(context).primary, + color: theme.palette.primary, size: 20, ); } @@ -81,8 +80,7 @@ class TableView extends StatelessWidget { onTap: item.onTap, url: item.url, child: DefaultTextStyle( - style: TextStyle( - fontSize: 17, color: theme.paletteOf(context).text), + style: TextStyle(fontSize: 17, color: theme.palette.text), overflow: TextOverflow.ellipsis, child: Container( height: 44, @@ -97,7 +95,7 @@ class TableView extends StatelessWidget { DefaultTextStyle( style: TextStyle( fontSize: 17, - color: theme.paletteOf(context).tertiaryText, + color: theme.palette.tertiaryText, ), child: item.rightWidget, ), @@ -106,8 +104,7 @@ class TableView extends StatelessWidget { if ((item.onTap != null || item.url != null) && !item.hideRightChevron) Icon(CupertinoIcons.right_chevron, - size: 20, - color: theme.paletteOf(context).tertiaryText) + size: 20, color: theme.palette.tertiaryText) else SizedBox(width: 2), SizedBox(width: 8), diff --git a/lib/widgets/timeline_item.dart b/lib/widgets/timeline_item.dart index 22c2928..6e4b770 100644 --- a/lib/widgets/timeline_item.dart +++ b/lib/widgets/timeline_item.dart @@ -34,8 +34,7 @@ class TimelineEventItem extends StatelessWidget { Expanded( child: Text.rich( TextSpan( - style: - TextStyle(color: theme.paletteOf(context).text, fontSize: 16), + style: TextStyle(color: theme.palette.text, fontSize: 16), children: [ // TODO: actor is null createUserSpan(context, actor), @@ -288,12 +287,12 @@ class TimelineItem extends StatelessWidget { TextSpan(text: ' branch from '), TextSpan( text: (p['beforeCommit']['oid'] as String).substring(0, 7), - style: TextStyle(color: theme.paletteOf(context).primary), + style: TextStyle(color: theme.palette.primary), ), TextSpan(text: ' to '), TextSpan( text: (p['afterCommit']['oid'] as String).substring(0, 7), - style: TextStyle(color: theme.paletteOf(context).primary), + style: TextStyle(color: theme.palette.primary), ), ], ), diff --git a/lib/widgets/user_item.dart b/lib/widgets/user_item.dart index af189e4..aa5a6a3 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.paletteOf(context).text, + // color: theme.palette.text, // fontSize: 18, // ), // ), @@ -54,7 +54,7 @@ class UserItem extends StatelessWidget { Text( login, style: TextStyle( - color: theme.paletteOf(context).primary, + color: theme.palette.primary, fontSize: 18, fontWeight: FontWeight.w600, ), @@ -65,7 +65,7 @@ class UserItem extends StatelessWidget { if (bio != null) DefaultTextStyle( style: TextStyle( - color: theme.paletteOf(context).secondaryText, + color: theme.palette.secondaryText, fontSize: 16, ), child: bio, diff --git a/lib/widgets/user_name.dart b/lib/widgets/user_name.dart index df046ee..756f38c 100644 --- a/lib/widgets/user_name.dart +++ b/lib/widgets/user_name.dart @@ -22,7 +22,7 @@ class UserName extends StatelessWidget { login, style: TextStyle( fontWeight: FontWeight.w600, - color: theme.paletteOf(context).primary, + color: theme.palette.primary, ), ), ),