Compare commits

..

No commits in common. "7188c556609dc277e3b93d9a904e688cf4ced586" and "3acf5b289951b556279b235a10691a7f57622621" have entirely different histories.

5 changed files with 104 additions and 193 deletions

View file

@ -18,8 +18,6 @@
- Make pie chart values more visible by adding the category's corresponding color as background - Make pie chart values more visible by adding the category's corresponding color as background
- Welcome text on Setup view is now centered - Welcome text on Setup view is now centered
- Editing entries is now done by tapping the entry, instead of a dedicated button - Editing entries is now done by tapping the entry, instead of a dedicated button
- return iOS (Cupertino) widgets only on iOS/macOS
- Show action sheet in graph settings on iOS instead of InkWell
# 1.0.0-alpha+5 # 1.0.0-alpha+5
- Add tests - Add tests

View file

@ -465,7 +465,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD)"; ARCHS = x86_64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@ -647,7 +647,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD)"; ARCHS = x86_64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@ -672,7 +672,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD)"; ARCHS = x86_64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";

View file

@ -39,11 +39,15 @@
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UISupportedInterfaceOrientations~ipad</key> <key>UISupportedInterfaceOrientations~ipad</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UTExportedTypeDeclarations</key> <key>UTExportedTypeDeclarations</key>
<array> <array>

View file

@ -11,10 +11,10 @@ abstract class PlatformWidget<A extends Widget, I extends Widget>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (Platform.isIOS || Platform.isMacOS) { if (Platform.isAndroid) {
return createIosWidget(context);
} else {
return createAndroidWidget(context); return createAndroidWidget(context);
} else {
return createIosWidget(context);
} }
} }

View file

@ -1,6 +1,3 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:settings_ui/settings_ui.dart'; import 'package:settings_ui/settings_ui.dart';
@ -50,47 +47,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
? AppLocalizations.of(context).barChart ? AppLocalizations.of(context).barChart
: AppLocalizations.of(context).lineChart, : AppLocalizations.of(context).lineChart,
), ),
onPressed: (c) { onPressed: (c) => showAdaptiveDialog<void>(
if (Platform.isIOS) {
// iOS does not use Material widgets => no inkwell support
showCupertinoModalPopup<void>(
context: context,
builder: (ctx) => CupertinoActionSheet(
title: Text(AppLocalizations.of(context).selectType),
actions: [
CupertinoActionSheetAction(
onPressed: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 1);
_yearly = 1;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
child: Text(
AppLocalizations.of(context).barChart,
textAlign: TextAlign.center,
),
),
CupertinoActionSheetAction(
onPressed: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 2);
_yearly = 2;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
child: Text(
AppLocalizations.of(context).lineChart,
textAlign: TextAlign.center,
),
),
],
),
);
} else {
showAdaptiveDialog<void>(
context: c, context: c,
builder: (ctx) => AlertDialog.adaptive( builder: (ctx) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).selectType), title: Text(AppLocalizations.of(context).selectType),
@ -109,8 +66,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
), ),
), ),
onTap: () async { onTap: () async {
final s = final s = await SharedPreferences.getInstance();
await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 1); await s.setInt("yearlygraph", 1);
_yearly = 1; _yearly = 1;
if (!ctx.mounted) return; if (!ctx.mounted) return;
@ -130,8 +86,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
), ),
), ),
onTap: () async { onTap: () async {
final s = final s = await SharedPreferences.getInstance();
await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 2); await s.setInt("yearlygraph", 2);
_yearly = 2; _yearly = 2;
if (!ctx.mounted) return; if (!ctx.mounted) return;
@ -144,9 +99,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
), ),
), ),
), ),
); ),
}
},
), ),
SettingsTile.navigation( SettingsTile.navigation(
title: Text(AppLocalizations.of(context).monthly), title: Text(AppLocalizations.of(context).monthly),
@ -155,47 +108,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
? AppLocalizations.of(context).barChart ? AppLocalizations.of(context).barChart
: AppLocalizations.of(context).lineChart, : AppLocalizations.of(context).lineChart,
), ),
onPressed: (c) { onPressed: (c) => showAdaptiveDialog<void>(
if (Platform.isIOS) {
// iOS does not use Material widgets => no inkwell support
showCupertinoModalPopup<void>(
context: context,
builder: (ctx) => CupertinoActionSheet(
title: Text(AppLocalizations.of(context).selectType),
actions: [
CupertinoActionSheetAction(
onPressed: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 1);
_monthly = 1;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
child: Text(
AppLocalizations.of(context).barChart,
textAlign: TextAlign.center,
),
),
CupertinoActionSheetAction(
onPressed: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 2);
_monthly = 2;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
child: Text(
AppLocalizations.of(context).lineChart,
textAlign: TextAlign.center,
),
),
],
),
);
} else {
showAdaptiveDialog<void>(
context: c, context: c,
builder: (ctx) => AlertDialog.adaptive( builder: (ctx) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).selectType), title: Text(AppLocalizations.of(context).selectType),
@ -214,8 +127,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
), ),
), ),
onTap: () async { onTap: () async {
final s = final s = await SharedPreferences.getInstance();
await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 1); await s.setInt("monthlygraph", 1);
_monthly = 1; _monthly = 1;
if (!ctx.mounted) return; if (!ctx.mounted) return;
@ -225,7 +137,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
), ),
), ),
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(ctx).size.width,
child: InkWell( child: InkWell(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
@ -235,8 +147,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
), ),
), ),
onTap: () async { onTap: () async {
final s = final s = await SharedPreferences.getInstance();
await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 2); await s.setInt("monthlygraph", 2);
_monthly = 2; _monthly = 2;
if (!ctx.mounted) return; if (!ctx.mounted) return;
@ -249,9 +160,7 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
), ),
), ),
), ),
); ),
}
},
), ),
], ],
), ),