diff --git a/lib/home.dart b/lib/home.dart index e536470b..3dc71bd9 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -191,20 +191,15 @@ class _HomeState extends State { search, me, ]; - break; case PlatformType.gitlab: return [explore, group, search, me]; - break; case PlatformType.bitbucket: return [explore, group, me]; - break; case PlatformType.gitea: return [group, me]; - break; case PlatformType.gitee: case PlatformType.gogs: return [search, me]; - break; default: return []; } diff --git a/lib/scaffolds/list_stateful.dart b/lib/scaffolds/list_stateful.dart index 8981cc77..e307fb7c 100644 --- a/lib/scaffolds/list_stateful.dart +++ b/lib/scaffolds/list_stateful.dart @@ -26,7 +26,7 @@ class ListStatefulScaffold extends StatefulWidget { final Widget title; final Widget Function()? actionBuilder; final Widget Function(T payload) itemBuilder; - final Future> Function(K cursor) fetch; + final Future> Function(K? cursor) fetch; ListStatefulScaffold({ required this.title, @@ -41,7 +41,7 @@ class ListStatefulScaffold extends StatefulWidget { } class _ListStatefulScaffoldState - extends State> { + extends State> { bool loading = false; bool loadingMore = false; String error = ''; diff --git a/lib/scaffolds/refresh_stateful.dart b/lib/scaffolds/refresh_stateful.dart index 1d2e6151..8b6e51c7 100644 --- a/lib/scaffolds/refresh_stateful.dart +++ b/lib/scaffolds/refresh_stateful.dart @@ -7,7 +7,8 @@ class RefreshStatefulScaffold extends StatefulWidget { final Widget title; final Widget? Function(T data, void Function(T newData) setData) bodyBuilder; final Future Function() fetch; - final Widget? Function(T data, void Function(T newData) setData)? actionBuilder; + final Widget? Function(T data, void Function(T newData) setData)? + actionBuilder; final Widget? action; final canRefresh; @@ -26,7 +27,7 @@ class RefreshStatefulScaffold extends StatefulWidget { } class _RefreshStatefulScaffoldState - extends State> { + extends State> { // bool _loading; T? _data; String _error = ''; @@ -60,7 +61,7 @@ class _RefreshStatefulScaffoldState Widget? get _action { if (widget.action != null) return widget.action; if (widget.actionBuilder == null || _data == null) return null; - return widget.actionBuilder!(_data, (v) { + return widget.actionBuilder!(_data!, (v) { setState(() { _data = v; }); @@ -70,7 +71,7 @@ class _RefreshStatefulScaffoldState @override Widget build(BuildContext context) { Widget child = ErrorLoadingWrapper( - bodyBuilder: () => widget.bodyBuilder(_data, (v) { + bodyBuilder: () => widget.bodyBuilder(_data!, (v) { setState(() { _data = v; }); diff --git a/lib/scaffolds/tab_stateful.dart b/lib/scaffolds/tab_stateful.dart index dc32598c..1823c0b2 100644 --- a/lib/scaffolds/tab_stateful.dart +++ b/lib/scaffolds/tab_stateful.dart @@ -22,7 +22,7 @@ class TabStatefulScaffold extends StatefulWidget { _TabStatefulScaffoldState createState() => _TabStatefulScaffoldState(); } -class _TabStatefulScaffoldState extends State> { +class _TabStatefulScaffoldState extends State> { late bool _loading; T? _payload0; T? _payload1; @@ -90,7 +90,7 @@ class _TabStatefulScaffoldState extends State> { title: widget.title, action: widget.actionBuilder == null ? null - : widget.actionBuilder!(_payload, _refresh), + : widget.actionBuilder!(_payload!, _refresh), tabs: widget.tabs, activeTab: _activeTab, onTabSwitch: (selected) async { @@ -105,7 +105,7 @@ class _TabStatefulScaffoldState extends State> { }, onRefresh: _refresh, body: ErrorLoadingWrapper( - bodyBuilder: () => widget.bodyBuilder(_payload, _activeTab), + bodyBuilder: () => widget.bodyBuilder(_payload!, _activeTab), error: _error, loading: _payload == null, reload: _refresh, diff --git a/lib/screens/gh_notification.dart b/lib/screens/gh_notification.dart index c6fd9993..d2756afd 100644 --- a/lib/screens/gh_notification.dart +++ b/lib/screens/gh_notification.dart @@ -20,7 +20,7 @@ class GhNotificationScreen extends StatefulWidget { } class GhNotificationScreenState extends State { - Future> fetchNotifications(int index) async { + Future> fetchNotifications(int index) async { final ns = await context.read().ghClient!.getJSON( '/notifications?all=${index == 2}&participating=${index == 1}', convert: (dynamic vs) => @@ -30,10 +30,10 @@ class GhNotificationScreenState extends State { context.read().setCount(ns.length); } - Map _groupMap = {}; + Map _groupMap = {}; ns.forEach((item) { - final repo = item.repository!.fullName; + final repo = item.repository!.fullName ?? ''; // TODO: nullable if (_groupMap[repo] == null) { _groupMap[repo] = NotificationGroup(repo); } @@ -155,7 +155,7 @@ ${item.key}: pullRequest(number: ${item.subject!.number}) { @override Widget build(context) { - return TabStatefulScaffold( + return TabStatefulScaffold>( title: AppBarTitle(AppLocalizations.of(context)!.notification), tabs: [ AppLocalizations.of(context)!.unread, diff --git a/lib/widgets/notification_item.dart b/lib/widgets/notification_item.dart index cc1070c4..967df160 100644 --- a/lib/widgets/notification_item.dart +++ b/lib/widgets/notification_item.dart @@ -42,7 +42,6 @@ class _NotificationItemState extends State { default: return _buildIcon(Octicons.person); } - break; case 'PullRequest': switch (payload.state) { case 'OPEN': @@ -54,7 +53,6 @@ class _NotificationItemState extends State { default: return _buildIcon(Octicons.person); } - break; // color: Color.fromRGBO(0x6f, 0x42, 0xc1, 1), case 'Release': return _buildIcon(Octicons.tag); diff --git a/pubspec.lock b/pubspec.lock index e35888ea..9ad1ba9e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -28,7 +28,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.6.1" boolean_selector: dependency: transitive description: @@ -760,7 +760,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -802,7 +802,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.3.0" timeago: dependency: "direct main" description: