diff --git a/mobile-app/lib/screens/warband_roster_screen.dart b/mobile-app/lib/screens/warband_roster_screen.dart index e42eff7..262f2aa 100644 --- a/mobile-app/lib/screens/warband_roster_screen.dart +++ b/mobile-app/lib/screens/warband_roster_screen.dart @@ -1,6 +1,7 @@ import 'package:badges/badges.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:timeago_flutter/timeago_flutter.dart'; import 'package:toolheim/data/github_adapter.dart'; import 'package:toolheim/widgets/stats_widget.dart'; @@ -43,8 +44,21 @@ class WarbandRosterScreen extends StatelessWidget { appBar: AppBar( title: Text(github.activeRoster.name), ), - drawer: - Drawer(child: SingleChildScrollView(child: WarbandDrawerWidget())), + drawer: Drawer( + child: Column(children: [ + Expanded(child: SingleChildScrollView(child: WarbandDrawerWidget())), + Container( + color: Colors.brown, + padding: EdgeInsets.all(10), + child: Align( + alignment: Alignment.bottomLeft, + child: Timeago( + date: github.lastSync, + builder: (_, value) => Text( + 'Last sync: ' + value, + style: TextStyle(color: Colors.white), + )))) + ])), body: SingleChildScrollView( child: Column(children: [ for (var hero in github.activeRoster.heros) diff --git a/mobile-app/lib/widgets/warband_drawer_widget.dart b/mobile-app/lib/widgets/warband_drawer_widget.dart index 68a82e2..a9d74a6 100644 --- a/mobile-app/lib/widgets/warband_drawer_widget.dart +++ b/mobile-app/lib/widgets/warband_drawer_widget.dart @@ -44,6 +44,9 @@ class WarbandDrawerWidget extends StatelessWidget { return Column(children: [ UserAccountsDrawerHeader( + currentAccountPicture: CircleAvatar( + child: Text(github.activeRoster.campaignPoints.toString() + ' CP'), + ), margin: const EdgeInsets.all(0), otherAccountsPictures: [ IconButton( @@ -103,16 +106,15 @@ class WarbandDrawerWidget extends StatelessWidget { badgeColor: Colors.black12, shape: BadgeShape.square, borderRadius: 2, - badgeContent: Text(roster.campaignPoints.toString() + ' CP', + badgeContent: Text(roster.experience().toString() + ' xp', style: TextStyle(color: Colors.white)), ), ), - Divider() ]); } void openHelpWebsite() async { - const url = 'http://git.datenhalter.de/aaron/toolheim/wiki/Home'; + const url = 'https://aaron-fischer.net/'; if (await canLaunch(url)) { await launch(url); } diff --git a/mobile-app/pubspec.lock b/mobile-app/pubspec.lock index 9ef4b57..739a35e 100644 --- a/mobile-app/pubspec.lock +++ b/mobile-app/pubspec.lock @@ -478,6 +478,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.2.5" + timeago: + dependency: transitive + description: + name: timeago + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.18" + timeago_flutter: + dependency: "direct main" + description: + name: timeago_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" timing: dependency: transitive description: diff --git a/mobile-app/pubspec.yaml b/mobile-app/pubspec.yaml index 7f1ce01..969b8dd 100644 --- a/mobile-app/pubspec.yaml +++ b/mobile-app/pubspec.yaml @@ -28,6 +28,7 @@ dependencies: preferences: localstorage: url_launcher: + timeago_flutter: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. diff --git a/mobile-app/test/widget_test.dart b/mobile-app/test/widget_test.dart deleted file mode 100644 index 10580a7..0000000 --- a/mobile-app/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:toolheim/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(Toolheim()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -}