Skip to content

Commit

Permalink
minor UI changes (prepare for Play releasing)
Browse files Browse the repository at this point in the history
  • Loading branch information
sun-jiao committed Jan 5, 2025
1 parent 26ef1c2 commit 8b4e7d9
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 24 deletions.
3 changes: 3 additions & 0 deletions lib/entities/localization_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mixin AppLocale {
static const String locationFilterOff = 'locationFilterOff';
static const String locationRetrieveFailed = 'locationRetrieveFailed';
static const String locationFilterError = 'locationFilterError';
static const String openSourceLicenses = 'openSourceLicenses';

static const Map<String, dynamic> EN = {
title: 'OSEA Bird ID',
Expand All @@ -41,6 +42,7 @@ mixin AppLocale {
locationFilterOff: 'Turn off location filter',
locationRetrieveFailed: 'Failed in retrieving device location, distribution filter not applied.',
locationFilterError: 'Distribution filter not applied due to unknown error.',
openSourceLicenses: 'Open source licenses',
};
static const Map<String, dynamic> ZH = {
title: 'OSEA鸟类识别',
Expand All @@ -62,6 +64,7 @@ mixin AppLocale {
locationFilterOff: '关闭分布区过滤',
locationRetrieveFailed: '未能获取位置信息,分布区过滤未能生效。',
locationFilterError: '发生未知错误,分布区过滤未能生效。',
openSourceLicenses: '开放源代码协议',
};
}

Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class _MyAppState extends State<MyApp> {
title: AppLocale.title.getString(context),
supportedLocales: _localization.supportedLocales,
localizationsDelegates: _localization.localizationsDelegates,
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
Expand Down
18 changes: 6 additions & 12 deletions lib/pages/predict_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,11 @@ class _PredictScreenState extends State<PredictScreen> {
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Stack(
Expanded(child: Stack(
children: [
AspectRatio(
aspectRatio: 1,
child: BlurredImageWidget(
imageProvider: MemoryImage(_image),
backProvider: MemoryImage(_file),
),
BlurredImageWidget(
imageProvider: MemoryImage(_image),
backProvider: MemoryImage(_file),
),
Positioned(
right: 4,
Expand Down Expand Up @@ -147,7 +144,7 @@ class _PredictScreenState extends State<PredictScreen> {
),
),
],
),
)),
if (isOutOfRange)
Center(
child: Padding(
Expand All @@ -157,11 +154,8 @@ class _PredictScreenState extends State<PredictScreen> {
),
),
),
Card(
Container(
margin: const EdgeInsets.all(16),
color: Colors.white,
surfaceTintColor: Colors.white,
shadowColor: Colors.transparent,
child: Column(
children: _topResults
.map((e) => ResultTile(result: e))
Expand Down
18 changes: 18 additions & 0 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_localization/flutter_localization.dart';
import 'package:url_launcher/url_launcher.dart';

import 'settings_child_page.dart';
import '../entities/localization_mixin.dart';
Expand Down Expand Up @@ -114,6 +115,23 @@ class _SettingsPageState extends State<SettingsPage> {
});
},
),
Divider(),
ListTile(
title: Text(AppLocale.openSourceLicenses.getString(context)),
onTap: () => showAboutDialog(
applicationName: AppLocale.title.getString(context),
context: context,
),
),
Divider(),
ListTile(
title: Text('GitHub'),
trailing: Icon(Icons.open_in_browser_rounded),
onTap: () => launchUrl(
Uri.parse("https://github.com/sun-jiao/osea_mobile"),
mode: LaunchMode.externalApplication,
),
),
],
),
),
Expand Down
29 changes: 17 additions & 12 deletions lib/widgets/predict_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ class ResultTile extends StatelessWidget {

@override
Widget build(BuildContext context) {
return ListTile(
leading: Icon(
getIcon(result.prob),
return Card(
color: Colors.white,
surfaceTintColor: Colors.white,
shadowColor: Colors.transparent,
child: ListTile(
leading: Icon(
getIcon(result.prob),
),
title: Text(
SharedPrefTool.selectedSpeciesDisplay != AppLocale.scientificName ? result.label : result.scientificName,
style: TextStyle(fontSize: 18, fontStyle: SharedPrefTool.selectedSpeciesDisplay == AppLocale.scientificName ? FontStyle.italic : null),
),
subtitle: SharedPrefTool.selectedSpeciesDisplay == AppLocale.nameBoth ? Text(
result.scientificName,
style: const TextStyle(fontStyle: FontStyle.italic),
) : null,
trailing: Text('${(result.prob * 100).toStringAsFixed(2)}%'),
),
title: Text(
SharedPrefTool.selectedSpeciesDisplay != AppLocale.scientificName ? result.label : result.scientificName,
style: TextStyle(fontSize: 18, fontStyle: SharedPrefTool.selectedSpeciesDisplay == AppLocale.scientificName ? FontStyle.italic : null),
),
subtitle: SharedPrefTool.selectedSpeciesDisplay == AppLocale.nameBoth ? Text(
result.scientificName,
style: const TextStyle(fontStyle: FontStyle.italic),
) : null,
trailing: Text('${(result.prob * 100).toStringAsFixed(2)}%'),
);
}

Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ dependencies:
path_provider: ^2.1.5
shared_preferences: ^2.3.4
sqflite: ^2.4.1
url_launcher: ^6.3.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 8b4e7d9

Please sign in to comment.