diff --git a/android/gradle.properties b/android/gradle.properties index ed86f0f26922ea79f4d0c8e0e84f6d74259952bb..3487476dc637023e34426ce50caf3343f91e3038 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.22 -app.versionCode=22 +app.versionName=0.0.23 +app.versionCode=23 diff --git a/fastlane/metadata/android/en-US/changelogs/23.txt b/fastlane/metadata/android/en-US/changelogs/23.txt new file mode 100644 index 0000000000000000000000000000000000000000..85b0a5e8e1918ad6cef80f19ef8452a7b5f0575e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/23.txt @@ -0,0 +1 @@ +Allow swipe to navigate between pages. diff --git a/fastlane/metadata/android/fr-FR/changelogs/23.txt b/fastlane/metadata/android/fr-FR/changelogs/23.txt new file mode 100644 index 0000000000000000000000000000000000000000..dab421becaf073eae1cadf0e03589ffa62615aa8 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/23.txt @@ -0,0 +1 @@ +Navigation entre pages par mouvement de "swipe". diff --git a/lib/cubit/bottom_nav_cubit.dart b/lib/cubit/bottom_nav_cubit.dart index 57acf9a988ba60cea389d2087e0b927eac654a8f..d061b97a5c5d706c9e01c9e2ad8197f5e02987d5 100644 --- a/lib/cubit/bottom_nav_cubit.dart +++ b/lib/cubit/bottom_nav_cubit.dart @@ -5,6 +5,9 @@ class BottomNavCubit extends HydratedCubit<int> { void updateIndex(int index) => emit(index); + void movePrevious() => emit((state > 0) ? state - 1 : state); + void moveNext() => emit((state < 2) ? state + 1 : state); + void getHomePage() => emit(0); void getDiscoveriesPage() => emit(1); void getStatisticsPage() => emit(2); diff --git a/lib/ui/screens/skeleton_screen.dart b/lib/ui/screens/skeleton_screen.dart index edef18deb6a78751e64073f458f8596ec0f5a8a4..9a10a7827f39bc45905c938200862c827bf707c2 100644 --- a/lib/ui/screens/skeleton_screen.dart +++ b/lib/ui/screens/skeleton_screen.dart @@ -27,18 +27,32 @@ class _SkeletonScreenState extends State<SkeletonScreen> { return BlocProvider<BottomNavCubit>( create: (BuildContext context) => BottomNavCubit(), - child: Scaffold( - appBar: StandardAppBar(notifyParent: refresh), - extendBodyBehindAppBar: false, - body: BlocBuilder<BottomNavCubit, int>( - builder: (BuildContext context, int state) { - return AnimatedSwitcher( - duration: const Duration(milliseconds: 300), - child: pageNavigation.elementAt(state)); - }, - ), - bottomNavigationBar: const BottomNavBar(), - backgroundColor: Theme.of(context).colorScheme.background, + child: BlocBuilder<BottomNavCubit, int>( + builder: (BuildContext context, int state) { + return GestureDetector( + onHorizontalDragEnd: (dragDetail) { + if (dragDetail.velocity.pixelsPerSecond.dx < 1) { + context.read<BottomNavCubit>().moveNext(); + } else { + context.read<BottomNavCubit>().movePrevious(); + } + }, + child: Scaffold( + appBar: StandardAppBar(notifyParent: refresh), + extendBodyBehindAppBar: false, + body: BlocBuilder<BottomNavCubit, int>( + builder: (BuildContext context, int state) { + return AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: pageNavigation.elementAt(state), + ); + }, + ), + bottomNavigationBar: const BottomNavBar(), + backgroundColor: Theme.of(context).colorScheme.background, + ), + ); + }, ), ); } diff --git a/lib/ui/widgets/bottom_nav_bar.dart b/lib/ui/widgets/bottom_nav_bar.dart index c06cecbf6e665b2981d5c5e80a91c16d544bc123..02aa39a6ee1af8d7891ff29850ff13866db409fa 100644 --- a/lib/ui/widgets/bottom_nav_bar.dart +++ b/lib/ui/widgets/bottom_nav_bar.dart @@ -21,31 +21,33 @@ class BottomNavBar extends StatelessWidget { topRight: Radius.circular(16), ), ), - child: BlocBuilder<BottomNavCubit, int>(builder: (BuildContext context, int state) { - return BottomNavigationBar( - currentIndex: state, - onTap: (int index) => context.read<BottomNavCubit>().updateIndex(index), - type: BottomNavigationBarType.fixed, - elevation: 0, - backgroundColor: Colors.transparent, - selectedItemColor: Theme.of(context).colorScheme.primary, - unselectedItemColor: Theme.of(context).textTheme.bodySmall!.color, - items: <BottomNavigationBarItem>[ - BottomNavigationBarItem( - icon: const Icon(Ionicons.home_outline), - label: tr('bottom_nav_home'), - ), - BottomNavigationBarItem( - icon: const Icon(Ionicons.star_outline), - label: tr('bottom_nav_discoveries'), - ), - BottomNavigationBarItem( - icon: const Icon(Ionicons.bar_chart_outline), - label: tr('bottom_nav_repartition'), - ), - ], - ); - }), + child: BlocBuilder<BottomNavCubit, int>( + builder: (BuildContext context, int state) { + return BottomNavigationBar( + currentIndex: state, + onTap: (int index) => context.read<BottomNavCubit>().updateIndex(index), + type: BottomNavigationBarType.fixed, + elevation: 0, + backgroundColor: Colors.transparent, + selectedItemColor: Theme.of(context).colorScheme.primary, + unselectedItemColor: Theme.of(context).textTheme.bodySmall!.color, + items: <BottomNavigationBarItem>[ + BottomNavigationBarItem( + icon: const Icon(Ionicons.home_outline), + label: tr('bottom_nav_home'), + ), + BottomNavigationBarItem( + icon: const Icon(Ionicons.star_outline), + label: tr('bottom_nav_discoveries'), + ), + BottomNavigationBarItem( + icon: const Icon(Ionicons.bar_chart_outline), + label: tr('bottom_nav_repartition'), + ), + ], + ); + }, + ), ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 415477b88b70f539b6e924691837cdf88f1714de..4b8265d88ef3e8fdede33dbf3be69b54da0f6e7a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Display scrobbles data and charts publish_to: 'none' -version: 0.0.22+22 +version: 0.0.23+23 environment: sdk: '^3.0.0'