Skip to content

Commit

Permalink
Make UI a bit nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvigee committed Jan 16, 2021
1 parent f3fd174 commit ee70fac
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 102 deletions.
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
android:exported="true"/>
<service android:name="rekab.app.background_locator.IsolateHolderService"
android:permission="android.permission.FOREGROUND_SERVICE"
android:exported="true"/>
android:exported="true"
android:foregroundServiceType = "location"/>

<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand Down
52 changes: 40 additions & 12 deletions lib/pages/organizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,51 @@ class _OrganizationsPageState extends State<OrganizationsPage> {
body: organizations == null
? Center(child: CircularProgressIndicator())
: RefreshIndicator(
child: ListView.builder(
child: ListView.separated(
itemCount: organizations.length,
itemBuilder: (context, index) {
var org = organizations[index];
return ListTile(
leading: Image.network(org.logoUrl),
title: Text(org.name),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RoutesPage(org.id),

return Stack(children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 5,
blurRadius: 7,
offset:
Offset(0, 3), // changes position of shadow
),
],
),
child: ListTile(
leading: Image.network(org.logoUrl),
title: Text(org.name),
contentPadding: EdgeInsets.all(10),
tileColor: Colors.white,
trailing: Icon(Icons.keyboard_arrow_right_outlined, size: 40, color: Colors.black87),
),
),
Positioned.fill(
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RoutesPage(org.id),
),
);
},
),
);
},
);
),
)
]);
},
separatorBuilder: (context, index) => SizedBox(height: 20),
),
onRefresh: fetchOrganizations,
));
Expand Down
1 change: 1 addition & 0 deletions lib/pages/root.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class RootPage extends StatelessWidget {
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
backgroundColor: Color(0xf4f4f4ff)
),
home: Material(
child: UpdatePage.build(
Expand Down
158 changes: 85 additions & 73 deletions lib/pages/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _RoutesPageState extends State<RoutesPage> {
body: routes == null
? Center(child: CircularProgressIndicator())
: RefreshIndicator(
child: ListView.builder(
child: ListView.separated(
itemCount: routes.length,
itemBuilder: (context, index) {
var route = routes[index];
Expand All @@ -89,6 +89,7 @@ class _RoutesPageState extends State<RoutesPage> {
orgId: this.orgId,
route: route);
},
separatorBuilder: (context, index) => SizedBox(height: 20),
),
onRefresh: fetchRoutes,
));
Expand Down Expand Up @@ -144,80 +145,91 @@ class RouteItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Stack(children: [
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
color: Colors.white,
),
child: Stack(children: [
Container(
child: Column(children: [
Container(
child: Column(children: [
Container(
child: Text(route.title,
style: Theme.of(context).textTheme.headline6),
padding: EdgeInsets.all(10)),
Row(
children: [
Image.network(
"${AppConfig.of(context).apiBaseUrl}/orgs/$orgId/routes/${route.id}/static/simplified/300/300",
width: 150,
),
Container(
child: Column(
children: [
Text(formatDistance(route.totalLength)),
route.published
? route.canceled
? Chip(
label: Text(
"Canceled",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
backgroundColor: Colors.red,
)
: Chip(
label: Text(
"Published",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
backgroundColor: Colors.green,
)
: Chip(
label: Text(
"Not Published",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
backgroundColor: Colors.grey[500],
),
],
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
padding: EdgeInsets.all(10))
],
)
], crossAxisAlignment: CrossAxisAlignment.stretch),
color: Colors.white),
Positioned.fill(
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TrackPage(this.orgId, route.id),
),
);
},
child: Text(route.title,
style: Theme.of(context).textTheme.headline6),
padding: EdgeInsets.all(10)),
Row(
children: [
Image.network(
"${AppConfig.of(context).apiBaseUrl}/orgs/$orgId/routes/${route.id}/static/simplified/300/300",
width: 150,
),
),
Container(
child: Column(
children: [
Text(formatDistance(route.totalLength)),
route.published
? route.canceled
? Chip(
label: Text(
"Canceled",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
backgroundColor: Colors.red,
)
: Chip(
label: Text(
"Published",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
backgroundColor: Colors.green,
)
: Chip(
label: Text(
"Not Published",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
backgroundColor: Colors.grey[500],
),
],
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
padding: EdgeInsets.all(10))
],
)
]),
margin: EdgeInsets.only(bottom: 20));
], crossAxisAlignment: CrossAxisAlignment.stretch)),
Positioned.fill(
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TrackPage(this.orgId, route.id),
),
);
},
),
),
)
]),
);
}
}
7 changes: 1 addition & 6 deletions lib/services/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ class AuthWidget extends StatelessWidget {
if (snapshot.connectionState == ConnectionState.done) {
return snapshot.hasData ? child : LoginPage();
} else {
return Material(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [CircularProgressIndicator()],
));
return Material(child: Center(child: CircularProgressIndicator()));
}
},
);
Expand Down
2 changes: 0 additions & 2 deletions lib/services/gql.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:retry/retry.dart';
import 'package:strollplanner_tracker/config.dart';
import 'package:strollplanner_tracker/services/auth.dart';

typedef DataFactory<D> = D Function(Map<String, dynamic>);

Expand Down
1 change: 0 additions & 1 deletion lib/services/tracker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'dart:isolate';
import 'dart:ui';
import 'package:background_locator/background_locator.dart';
import 'package:background_locator/location_dto.dart';
import 'package:retry/retry.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:strollplanner_tracker/config.dart';
Expand Down
12 changes: 6 additions & 6 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ packages:
name: background_locator
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2+1"
version: "1.3.2+1"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -211,7 +211,7 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.24"
version: "1.6.27"
path_provider_linux:
dependency: transitive
description:
Expand All @@ -225,7 +225,7 @@ packages:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+6"
version: "0.0.4+8"
path_provider_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -295,7 +295,7 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.2+2"
version: "4.3.2+4"
retry:
dependency: "direct main"
description:
Expand All @@ -309,14 +309,14 @@ packages:
name: sentry
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
shared_preferences:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0

background_locator: ^1.2.2+1
background_locator: ^1.3.2+1
uni_links: ^0.4.0
provider: ^4.3.2
url_launcher: ^5.7.10
Expand Down

0 comments on commit ee70fac

Please sign in to comment.