Skip to content

Commit

Permalink
Show loading gif instead of 3 dots on No Notifications page
Browse files Browse the repository at this point in the history
resolves #66
  • Loading branch information
maxisme committed May 23, 2021
1 parent 563d4bf commit 7329507
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
37 changes: 22 additions & 15 deletions lib/notifications/notifications_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:notifi/notifications/notification.dart';
import 'package:notifi/notifications/notifis.dart';
import 'package:notifi/screens/utils/loading_gif.dart';
import 'package:notifi/user.dart';
import 'package:notifi/utils/icons.dart';
import 'package:notifi/utils/pallete.dart';
Expand Down Expand Up @@ -57,8 +58,26 @@ class NotificationTableState extends State<NotificationTable>
Container(padding: const EdgeInsets.only(top: 20.0)),
Consumer<User>(
builder: (BuildContext context, User user, Widget child) {
String credentials = user.getCredentials();
credentials ??= '...';
final String credentials = user.getCredentials();
Widget credentialsWidget;
if (credentials != null) {
credentialsWidget = SelectableText(credentials,
textAlign: TextAlign.center, onTap: () {
if (Platform.isIOS) {
Share.share(credentials);
} else {
Clipboard.setData(ClipboardData(text: credentials));
Toast.show('Copied $credentials', context,
gravity: Toast.BOTTOM);
}
},
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.w900));
} else {
credentialsWidget = LoadingGif();
}

return Column(children: <Widget>[
RichText(
textAlign: TextAlign.center,
Expand Down Expand Up @@ -97,19 +116,7 @@ class NotificationTableState extends State<NotificationTable>
),
),
Container(padding: const EdgeInsets.only(top: 20.0)),
SelectableText(credentials, textAlign: TextAlign.center,
onTap: () {
if (Platform.isIOS) {
Share.share(credentials);
} else {
Clipboard.setData(ClipboardData(text: credentials));
Toast.show('Copied $credentials', context,
gravity: Toast.BOTTOM);
}
},
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.w900))
credentialsWidget
]);
})
]);
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/utils/loading_gif.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LoadingGif extends StatelessWidget {
height: 20.0,
width: 20.0,
child: CircularProgressIndicator(
strokeWidth: 1,
strokeWidth: 2,
)),
));
}
Expand Down
Binary file modified test/golden-asserts/screen/no-notifications.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7329507

Please sign in to comment.