fix: optimization for iOS #30

Merged
hernik merged 8 commits from dev-ios into dev 2024-01-29 23:51:25 +01:00
6 changed files with 83 additions and 25 deletions
Showing only changes of commit 94b387db43 - Show all commits

View file

@ -7,6 +7,8 @@
- Added sorting by oldest - Added sorting by oldest
- Moved search into three-dot menu - Moved search into three-dot menu
- Make search case-insensitive - Make search case-insensitive
- Added titles above graphs
- Some extra optimization for iOS
# 1.0.0-alpha+5 # 1.0.0-alpha+5
- Add tests - Add tests
- Add searching through entries to homepage - Add searching through entries to homepage

View file

@ -110,5 +110,8 @@
"sortNewest":"Nejnovější první", "sortNewest":"Nejnovější první",
"sortOldest":"Nejstarší první", "sortOldest":"Nejstarší první",
"sort":"Seřadit", "sort":"Seřadit",
"search":"Prohledat" "search":"Prohledat",
"expensesPerYear":"Měsíční výdaje v roce {year}",
"expensesPerMonth":"Denní výdaje během měsíce {monthYear}",
"expensesPerCategory":"Total expenses per category"
} }

View file

@ -226,5 +226,26 @@
"sortNewest":"Newest first", "sortNewest":"Newest first",
"sortOldest":"Oldest first", "sortOldest":"Oldest first",
"sort":"Sort", "sort":"Sort",
"search":"Search" "search":"Search",
"expensesPerYear":"Expenses per month in {year}",
"@expensesPerYear":{
"placeholders": {
"year":{
"description": "The year of the monthly expense sum",
"example": "2024",
"type": "int"
}
}
},
"expensesPerMonth":"Expenses per day during {monthYear}",
"@expensesPerMonth":{
"placeholders": {
"monthYear":{
"description": "Month and year formatted through DateFormat class",
"example": "June, 2024",
"type": "String"
}
}
},
"expensesPerCategory":"Total expenses per category"
} }

View file

@ -78,8 +78,16 @@ class MyApp extends StatelessWidget {
? darkColorScheme ? darkColorScheme
: lightColorScheme, : lightColorScheme,
), ),
child: const CupertinoApp( child: CupertinoApp(
localizationsDelegates: [ theme: CupertinoThemeData(
textTheme: CupertinoTextThemeData(
primaryColor:
((MediaQuery.of(context).platformBrightness ==
Brightness.dark)
? darkColorScheme
: lightColorScheme)
.onPrimary)),
localizationsDelegates: const [
AppLocalizations.delegate, AppLocalizations.delegate,
...GlobalMaterialLocalizations.delegates, ...GlobalMaterialLocalizations.delegates,
...GlobalCupertinoLocalizations.delegates, ...GlobalCupertinoLocalizations.delegates,

View file

@ -71,6 +71,7 @@ class ExpensesLineChart extends StatelessWidget {
LineChartData( LineChartData(
lineTouchData: LineTouchData( lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData( touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Theme.of(context).colorScheme.secondaryContainer,
getTooltipItems: (spots) => List<LineTooltipItem>.generate( getTooltipItems: (spots) => List<LineTooltipItem>.generate(
spots.length, spots.length,
(index) => LineTooltipItem( (index) => LineTooltipItem(
@ -439,7 +440,9 @@ class _CategoriesPieChartState extends State<CategoriesPieChart> {
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),
Expanded( LimitedBox(
maxHeight: MediaQuery.of(context).size.height * 0.23,
maxWidth: MediaQuery.of(context).size.width * 0.9,
child: PieChart( child: PieChart(
PieChartData( PieChartData(
centerSpaceRadius: double.infinity, centerSpaceRadius: double.infinity,

View file

@ -96,18 +96,8 @@ class _GraphViewState extends State<GraphView> {
return Scaffold( return Scaffold(
floatingActionButton: Tooltip( floatingActionButton: Tooltip(
message: AppLocalizations.of(context).changeDate, message: AppLocalizations.of(context).changeDate,
child: PlatformButton( child: FloatingActionButton(
style: ButtonStyle( child: const Icon(Icons.calendar_month),
backgroundColor: MaterialStateProperty.all(
Theme.of(context).colorScheme.primary,
),
foregroundColor: MaterialStateProperty.all(
Theme.of(context).colorScheme.onPrimary,
),
),
text: yearly
? DateFormat.y(locale).format(_selectedDate)
: DateFormat.yMMMM(locale).format(_selectedDate),
onPressed: () async { onPressed: () async {
final firstDate = (selectedWallet!.entries final firstDate = (selectedWallet!.entries
..sort( ..sort(
@ -266,6 +256,23 @@ class _GraphViewState extends State<GraphView> {
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Column( child: Column(
children: [ children: [
Text(
yearly
? AppLocalizations.of(context)
.expensesPerYear(_selectedDate.year)
: AppLocalizations.of(context)
.expensesPerMonth(
DateFormat.yMMMM()
.format(_selectedDate),
),
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 15,
),
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.9, width: MediaQuery.of(context).size.width * 0.9,
height: height:
@ -328,14 +335,28 @@ class _GraphViewState extends State<GraphView> {
Theme.of(context).colorScheme.secondaryContainer, Theme.of(context).colorScheme.secondaryContainer,
), ),
width: MediaQuery.of(context).size.width * 0.95, width: MediaQuery.of(context).size.width * 0.95,
height: MediaQuery.of(context).size.height * 0.35, height: MediaQuery.of(context).size.height * 0.4,
child: Padding( child: Column(
padding: const EdgeInsets.all(8), children: [
child: CategoriesPieChart( const SizedBox(
symbol: selectedWallet!.currency.symbol, height: 10,
entries: selectedWallet!.entries, ),
categories: selectedWallet!.categories, Text(
), AppLocalizations.of(context).expensesPerCategory,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Padding(
padding: const EdgeInsets.all(8),
child: CategoriesPieChart(
symbol: selectedWallet!.currency.symbol,
entries: selectedWallet!.entries,
categories: selectedWallet!.categories,
),
),
],
), ),
), ),
], ],