From 6a25c8289c6842f2913219f52076b2a258dda4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Sat, 10 Feb 2024 16:00:15 +0100 Subject: [PATCH] fix: settings style --- lib/views/settings/graph_type.dart | 154 +++++++++++++------------- lib/views/settings/tessdata_list.dart | 1 + 2 files changed, 81 insertions(+), 74 deletions(-) diff --git a/lib/views/settings/graph_type.dart b/lib/views/settings/graph_type.dart index 332b84d..14d1b02 100644 --- a/lib/views/settings/graph_type.dart +++ b/lib/views/settings/graph_type.dart @@ -51,49 +51,52 @@ class _GraphTypeSettingsViewState extends State { context: c, builder: (ctx) => AlertDialog.adaptive( title: Text(AppLocalizations.of(context).selectType), - content: Column( - children: [ - SizedBox( - width: MediaQuery.of(ctx).size.width, - child: InkWell( - child: Padding( - padding: const EdgeInsets.all(8), - child: Text( - AppLocalizations.of(context).barChart, - textAlign: TextAlign.center, + content: SizedBox( + height: 80, + child: Column( + children: [ + SizedBox( + width: MediaQuery.of(ctx).size.width, + child: InkWell( + child: Padding( + padding: const EdgeInsets.all(8), + child: Text( + AppLocalizations.of(context).barChart, + textAlign: TextAlign.center, + ), ), + onTap: () async { + final s = await SharedPreferences.getInstance(); + await s.setInt("yearlygraph", 1); + _yearly = 1; + if (!ctx.mounted) return; + Navigator.of(ctx).pop(); + setState(() {}); + }, ), - onTap: () async { - final s = await SharedPreferences.getInstance(); - await s.setInt("yearlygraph", 1); - _yearly = 1; - if (!ctx.mounted) return; - Navigator.of(ctx).pop(); - setState(() {}); - }, ), - ), - SizedBox( - width: MediaQuery.of(context).size.width, - child: InkWell( - child: Padding( - padding: const EdgeInsets.all(8), - child: Text( - AppLocalizations.of(context).lineChart, - textAlign: TextAlign.center, + SizedBox( + width: MediaQuery.of(context).size.width, + child: InkWell( + child: Padding( + padding: const EdgeInsets.all(8), + child: Text( + AppLocalizations.of(context).lineChart, + textAlign: TextAlign.center, + ), ), + onTap: () async { + final s = await SharedPreferences.getInstance(); + await s.setInt("yearlygraph", 2); + _yearly = 2; + if (!ctx.mounted) return; + Navigator.of(ctx).pop(); + setState(() {}); + }, ), - onTap: () async { - final s = await SharedPreferences.getInstance(); - await s.setInt("yearlygraph", 2); - _yearly = 2; - if (!ctx.mounted) return; - Navigator.of(ctx).pop(); - setState(() {}); - }, ), - ), - ], + ], + ), ), ), ), @@ -109,49 +112,52 @@ class _GraphTypeSettingsViewState extends State { context: c, builder: (ctx) => AlertDialog.adaptive( title: Text(AppLocalizations.of(context).selectType), - content: Column( - children: [ - SizedBox( - width: MediaQuery.of(ctx).size.width, - child: InkWell( - child: Padding( - padding: const EdgeInsets.all(8), - child: Text( - AppLocalizations.of(context).barChart, - textAlign: TextAlign.center, + content: SizedBox( + height: 80, + child: Column( + children: [ + SizedBox( + width: MediaQuery.of(ctx).size.width, + child: InkWell( + child: Padding( + padding: const EdgeInsets.all(8), + child: Text( + AppLocalizations.of(context).barChart, + textAlign: TextAlign.center, + ), ), + onTap: () async { + final s = await SharedPreferences.getInstance(); + await s.setInt("monthlygraph", 1); + _monthly = 1; + if (!ctx.mounted) return; + Navigator.of(ctx).pop(); + setState(() {}); + }, ), - onTap: () async { - final s = await SharedPreferences.getInstance(); - await s.setInt("monthlygraph", 1); - _monthly = 1; - if (!ctx.mounted) return; - Navigator.of(ctx).pop(); - setState(() {}); - }, ), - ), - SizedBox( - width: MediaQuery.of(ctx).size.width, - child: InkWell( - child: Padding( - padding: const EdgeInsets.all(8), - child: Text( - AppLocalizations.of(context).lineChart, - textAlign: TextAlign.center, + SizedBox( + width: MediaQuery.of(ctx).size.width, + child: InkWell( + child: Padding( + padding: const EdgeInsets.all(8), + child: Text( + AppLocalizations.of(context).lineChart, + textAlign: TextAlign.center, + ), ), + onTap: () async { + final s = await SharedPreferences.getInstance(); + await s.setInt("monthlygraph", 2); + _monthly = 2; + if (!ctx.mounted) return; + Navigator.of(ctx).pop(); + setState(() {}); + }, ), - onTap: () async { - final s = await SharedPreferences.getInstance(); - await s.setInt("monthlygraph", 2); - _monthly = 2; - if (!ctx.mounted) return; - Navigator.of(ctx).pop(); - setState(() {}); - }, ), - ), - ], + ], + ), ), ), ), diff --git a/lib/views/settings/tessdata_list.dart b/lib/views/settings/tessdata_list.dart index 890738f..283596e 100644 --- a/lib/views/settings/tessdata_list.dart +++ b/lib/views/settings/tessdata_list.dart @@ -152,6 +152,7 @@ class _TessdataListViewState extends State { /// so we can show it to the user Future loadAllTessdata() async { final tessDir = Directory(await FlutterTesseractOcr.getTessdataPath()); + if (!tessDir.existsSync()) tessDir.createSync(recursive: true); final d = await TessdataApi.getAvailableData(); final dataStatus = >[]; for (final data in d) {