add last sync

This commit is contained in:
Aaron Fischer 2019-08-11 22:36:56 +02:00
parent 47d41f58e4
commit 9409f91330
5 changed files with 36 additions and 35 deletions

View file

@ -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: <Widget>[
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)

View file

@ -44,6 +44,9 @@ class WarbandDrawerWidget extends StatelessWidget {
return Column(children: <Widget>[
UserAccountsDrawerHeader(
currentAccountPicture: CircleAvatar(
child: Text(github.activeRoster.campaignPoints.toString() + ' CP'),
),
margin: const EdgeInsets.all(0),
otherAccountsPictures: <Widget>[
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);
}

View file

@ -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:

View file

@ -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.

View file

@ -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);
});
}