Skip to content

Commit

Permalink
chore(demo-app): more ui improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-Frost committed Jul 4, 2022
1 parent 52f351b commit f48667d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class CachedMedications {
static Future<void> save() async =>
Hive.box<CachedMedications>(_boxName).put('data', _instance);

static Future<void> deleteFromDisk() async =>
Hive.box<CachedMedications>(_boxName).deleteFromDisk();
static Future<void> clearBox() async =>
Hive.box<CachedMedications>(_boxName).clear();

/// Caches a list of medications along with their guidelines
///
Expand Down
3 changes: 1 addition & 2 deletions miscellaneous/demo-app/lib/common/models/metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class MetaData {
static Future<void> save() async =>
Hive.box<MetaData>(_boxName).put('data', _instance);

static Future<void> deleteFromDisk() async =>
Hive.box<MetaData>(_boxName).deleteFromDisk();
static Future<void> clearBox() async => Hive.box<MetaData>(_boxName).clear();

@HiveField(0)
DateTime? lookupsLastFetchDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class UserData {
static Future<void> save() async =>
Hive.box<UserData>(_boxName).put('data', _instance);

static Future<void> deleteFromDisk() async =>
Hive.box<UserData>(_boxName).deleteFromDisk();
static Future<void> clearBox() async => Hive.box<UserData>(_boxName).clear();

@HiveField(0)
List<Diplotype>? diplotypes;
Expand Down
19 changes: 17 additions & 2 deletions miscellaneous/demo-app/lib/login/pages/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class _LoginPageState extends State<LoginPage> {
child: ElevatedButton(
onPressed: context.read<LoginPageCubit>().fakeLoadGeneticData,
style: ButtonStyle(
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(vertical: 12),
),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
Expand All @@ -81,13 +84,19 @@ class _LoginPageState extends State<LoginPage> {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset('assets/images/logo-horizontal.png'),
Image.asset(
'assets/images/logo-horizontal.png',
width: MediaQuery.of(context).size.width * 0.6,
),
CircularProgressIndicator(),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: null, // disabled state
style: ButtonStyle(
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(vertical: 12),
),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
Expand All @@ -105,7 +114,10 @@ class _LoginPageState extends State<LoginPage> {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset('assets/images/logo-horizontal.png'),
Image.asset(
'assets/images/logo-horizontal.png',
width: MediaQuery.of(context).size.width * 0.6,
),
Column(
children: [
Icon(
Expand All @@ -126,6 +138,9 @@ class _LoginPageState extends State<LoginPage> {
child: ElevatedButton(
onPressed: () => context.router.replace(MainRoute()),
style: ButtonStyle(
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(vertical: 12),
),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
Expand Down
6 changes: 3 additions & 3 deletions miscellaneous/demo-app/lib/settings/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import '../common/models/medication/cached_medications.dart';
import '../common/module.dart';

Future<void> deleteAllAppData() async {
await MetaData.deleteFromDisk();
await UserData.deleteFromDisk();
await CachedMedications.deleteFromDisk();
await MetaData.clearBox();
await UserData.clearBox();
await CachedMedications.clearBox();
// await _deleteCacheDir();
// await _deleteAppDir();
}
Expand Down

0 comments on commit f48667d

Please sign in to comment.