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
- Moved search into three-dot menu
- Make search case-insensitive
- Added titles above graphs
- Some extra optimization for iOS
# 1.0.0-alpha+5
- Add tests
- Add searching through entries to homepage

View file

@ -110,5 +110,8 @@
"sortNewest":"Nejnovější první",
"sortOldest":"Nejstarší první",
"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",
"sortOldest":"Oldest first",
"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
: lightColorScheme,
),
child: const CupertinoApp(
localizationsDelegates: [
child: CupertinoApp(
theme: CupertinoThemeData(
textTheme: CupertinoTextThemeData(
primaryColor:
((MediaQuery.of(context).platformBrightness ==
Brightness.dark)
? darkColorScheme
: lightColorScheme)
.onPrimary)),
localizationsDelegates: const [
AppLocalizations.delegate,
...GlobalMaterialLocalizations.delegates,
...GlobalCupertinoLocalizations.delegates,

View file

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

View file

@ -96,18 +96,8 @@ class _GraphViewState extends State<GraphView> {
return Scaffold(
floatingActionButton: Tooltip(
message: AppLocalizations.of(context).changeDate,
child: PlatformButton(
style: ButtonStyle(
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),
child: FloatingActionButton(
child: const Icon(Icons.calendar_month),
onPressed: () async {
final firstDate = (selectedWallet!.entries
..sort(
@ -266,6 +256,23 @@ class _GraphViewState extends State<GraphView> {
padding: const EdgeInsets.all(8),
child: Column(
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(
width: MediaQuery.of(context).size.width * 0.9,
height:
@ -328,8 +335,20 @@ class _GraphViewState extends State<GraphView> {
Theme.of(context).colorScheme.secondaryContainer,
),
width: MediaQuery.of(context).size.width * 0.95,
height: MediaQuery.of(context).size.height * 0.35,
child: Padding(
height: MediaQuery.of(context).size.height * 0.4,
child: Column(
children: [
const SizedBox(
height: 10,
),
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,
@ -337,6 +356,8 @@ class _GraphViewState extends State<GraphView> {
categories: selectedWallet!.categories,
),
),
],
),
),
],
),