Skip to content

Commit

Permalink
chore: add a build script and improve preferences screen layout
Browse files Browse the repository at this point in the history
  • Loading branch information
JunioJsv committed Jul 27, 2024
1 parent 8814f34 commit 0b3ef5c
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 39 deletions.
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
android.enableR8.fullMode=true
29 changes: 29 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@echo off
setlocal

:: Define the output directory for debug info
set DEBUG_INFO_DIR=build/debug_info

:: Create the debug info directory if it doesn't exist
if not exist %DEBUG_INFO_DIR% (
mkdir %DEBUG_INFO_DIR%
)

:: Prompt the user to choose between APK and AAB
echo Choose build type:
echo 1. APK
echo 2. AAB
set /p buildType="Enter 1 or 2: "

if "%buildType%" == "1" (
echo Building APK...
flutter build apk --split-per-abi --obfuscate --split-debug-info=%DEBUG_INFO_DIR%
) else if "%buildType%" == "2" (
echo Building AAB...
flutter build appbundle --obfuscate --split-debug-info=%DEBUG_INFO_DIR%
) else (
echo Invalid choice. The script will exit.
exit /b 1
)

endlocal
8 changes: 5 additions & 3 deletions lib/features/applications/widgets/application_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ class ApplicationIconState extends State<ApplicationIcon>
]
: null,
),
child: FadeInImage(
placeholder: MemoryImage(kTransparentImage),
image: MemoryImage(bytes),
child: SizedBox.expand(
child: FadeInImage(
placeholder: MemoryImage(kTransparentImage),
image: MemoryImage(bytes),
),
),
);
},
Expand Down
8 changes: 5 additions & 3 deletions lib/features/preferences/screens/preferences_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class PreferencesScreen extends StatelessWidget {
builder: (context, value) {
return SwitchListTile(
title: Text(translation.gridView),
subtitle: Text(translation.enableGridView),
value: value,
onChanged: (value) => preferences.update((preferences) {
return preferences.copyWith(isGridLayoutEnabled: value);
Expand All @@ -63,6 +62,8 @@ class PreferencesScreen extends StatelessWidget {
return SliderListTile(
min: 3,
max: 5,
title: translation.gridCrossAxisCount,
subtitle: translation.defineApplicationsPerLine,
isEnabled: preference.isEnabled,
value: preference.count,
onChange: (int value) => preferences.update((preferences) {
Expand All @@ -71,7 +72,7 @@ class PreferencesScreen extends StatelessWidget {
);
},
),
const Divider(height: 48),
const Divider(height: 32),
CategoryText(text: translation.general),
BlocSelector<PreferencesManagerCubit, PreferencesManagerState, bool>(
bloc: preferences,
Expand Down Expand Up @@ -117,7 +118,7 @@ class PreferencesScreen extends StatelessWidget {
);
},
),
const Divider(height: 48),
const Divider(height: 32),
CategoryText(text: translation.about),
FutureBuilder<Application>(
future: service.getApplication('juniojsv.minimum'),
Expand Down Expand Up @@ -154,6 +155,7 @@ class PreferencesScreen extends StatelessWidget {
);
},
),
const SizedBox(height: kToolbarHeight),
],
),
);
Expand Down
7 changes: 3 additions & 4 deletions lib/features/preferences/widgets/category_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ class CategoryText extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Padding(
padding: const EdgeInsets.all(16),
child: Text(
return ListTile(
title: Text(
text,
style: theme.textTheme.labelLarge!
.copyWith(color: theme.colorScheme.onSurfaceVariant),
.copyWith(color: theme.colorScheme.primary),
),
);
}
Expand Down
62 changes: 39 additions & 23 deletions lib/features/preferences/widgets/slider_list_tile.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:flutter/material.dart';
import 'package:minimum/i18n/translations.g.dart';

class SliderListTile extends StatefulWidget {
final String title;
final String? subtitle;
final int value;
final void Function(int value) onChange;
final int min;
Expand All @@ -15,6 +16,8 @@ class SliderListTile extends StatefulWidget {
required this.onChange,
required this.min,
required this.max,
required this.title,
this.subtitle,
});

@override
Expand All @@ -29,29 +32,42 @@ class _SliderListTileState extends State<SliderListTile> {

@override
Widget build(BuildContext context) {
final translation = context.translations;
return ListTile(
title: Text(translation.gridCrossAxisCount),
subtitle: Padding(
padding: const EdgeInsets.only(top: 16),
child: Slider(
value: _value,
min: widget.min.toDouble(),
max: widget.max.toDouble(),
label: '${_value.round()}',
onChanged: widget.isEnabled
? (value) {
setState(() {
_value = value;
});
}
: null,
onChangeEnd: (value) {
widget.onChange(value.round());
},
divisions: widget.max - widget.min,
final subtitle = widget.subtitle;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
title: Text(widget.title),
subtitle: subtitle != null ? Text(subtitle) : null,
),
),
Row(
children: [
Expanded(
child: Slider(
value: _value,
min: widget.min.toDouble(),
max: widget.max.toDouble(),
// label: '${_value.round()}',
onChanged: widget.isEnabled
? (value) {
setState(() {
_value = value;
});
}
: null,
onChangeEnd: (value) {
widget.onChange(value.round());
},
divisions: widget.max - widget.min,
),
),
Padding(
padding: const EdgeInsets.only(left: 8, right: 24),
child: Text('${_value.round()}'),
)
],
),
],
);
}
}
2 changes: 1 addition & 1 deletion lib/i18n/language_en-US.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"preferences": "Preferences",
"appearance": "Appearance",
"grid_view": "Grid view",
"enable_grid_view": "Enable grid view",
"grid_cross_axis_count": "Number of grid columns",
"define_applications_per_line": "Set the number of applications per line",
"set_has_default_launcher": "Set as default launcher",
"ask_set_has_default_launcher": "Do you want to set this app as the default launcher?",
"yes": "Yes",
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/language_pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"preferences": "Preferências",
"appearance": "Aparência",
"grid_view": "Visualização em grade",
"enable_grid_view": "Habilitar visualização em grade",
"grid_cross_axis_count": "Número de colunas da grade",
"define_applications_per_line": "Defina a quantidade de aplicativos por linha",
"set_has_default_launcher": "Definir como Launcher padrão",
"ask_set_has_default_launcher": "Você deseja definir esse aplicativo como Launcher padrão?",
"yes": "Sim",
Expand Down
2 changes: 1 addition & 1 deletion lib/themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const appBarTheme = AppBarTheme(elevation: 1);

SliderThemeData sliderTheme(ColorScheme colorScheme) {
return SliderThemeData(
overlayShape: SliderComponentShape.noOverlay,
// overlayShape: SliderComponentShape.noOverlay,
inactiveTrackColor: colorScheme.primary.withOpacity(.2),
);
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,10 @@ packages:
dependency: transitive
description:
name: url_launcher_ios
sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89"
sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e
url: "https://pub.dev"
source: hosted
version: "6.3.0"
version: "6.3.1"
url_launcher_linux:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: minimum
description: "Android app launcher"
publish_to: 'none'

version: 2.0.0+143
version: 2.0.1+144

environment:
sdk: '>=3.4.0 <4.0.0'
Expand Down

0 comments on commit 0b3ef5c

Please sign in to comment.