Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • android/org.benoitharrault.scrobbles
1 result
Show changes
Commits on Source (4)
...@@ -44,7 +44,7 @@ android { ...@@ -44,7 +44,7 @@ android {
defaultConfig { defaultConfig {
applicationId "org.benoitharrault.scrobbles" applicationId "org.benoitharrault.scrobbles"
minSdkVersion 16 minSdkVersion flutter.minSdkVersion
targetSdkVersion 30 targetSdkVersion 30
versionCode appVersionCode.toInteger() versionCode appVersionCode.toInteger()
versionName appVersionName versionName appVersionName
......
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.29 app.versionName=0.0.31
app.versionCode=29 app.versionCode=31
Update dependencies.
Improve swipe navigation.
Mise à jour des dépendances.
Amélioration de la navigation par swipe.
...@@ -3,18 +3,25 @@ import 'package:hydrated_bloc/hydrated_bloc.dart'; ...@@ -3,18 +3,25 @@ import 'package:hydrated_bloc/hydrated_bloc.dart';
class BottomNavCubit extends HydratedCubit<int> { class BottomNavCubit extends HydratedCubit<int> {
BottomNavCubit() : super(0); BottomNavCubit() : super(0);
void updateIndex(int index) => emit(index); int pagesCount = 3;
void movePrevious() => emit((state > 0) ? state - 1 : state); void updateIndex(int index) {
void moveNext() => emit((state < 2) ? state + 1 : state); if (isIndexAllowed(index)) {
emit(index);
} else {
goToHomePage();
}
}
bool isIndexAllowed(int index) {
return (index >= 0) && (index < pagesCount);
}
void getHomePage() => emit(0); void goToHomePage() => emit(0);
void getDiscoveriesPage() => emit(1);
void getStatisticsPage() => emit(2);
@override @override
int? fromJson(Map<String, dynamic> json) { int? fromJson(Map<String, dynamic> json) {
return json['pageIndex'] as int?; return 0;
} }
@override @override
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_swipe/flutter_swipe.dart';
import 'package:scrobbles/cubit/bottom_nav_cubit.dart'; import 'package:scrobbles/cubit/bottom_nav_cubit.dart';
import 'package:scrobbles/ui/screens/discoveries.dart'; import 'package:scrobbles/ui/screens/discoveries.dart';
...@@ -28,28 +29,31 @@ class _SkeletonScreenState extends State<SkeletonScreen> { ...@@ -28,28 +29,31 @@ class _SkeletonScreenState extends State<SkeletonScreen> {
create: (BuildContext context) => BottomNavCubit(), create: (BuildContext context) => BottomNavCubit(),
child: BlocBuilder<BottomNavCubit, int>( child: BlocBuilder<BottomNavCubit, int>(
builder: (BuildContext context, int state) { builder: (BuildContext context, int state) {
return GestureDetector( return Scaffold(
onHorizontalDragEnd: (dragDetail) { appBar: StandardAppBar(notifyParent: refresh),
if (dragDetail.velocity.pixelsPerSecond.dx < 1) { extendBodyBehindAppBar: false,
context.read<BottomNavCubit>().moveNext(); body: Swiper(
} else { itemCount: BlocProvider.of<BottomNavCubit>(context).pagesCount,
context.read<BottomNavCubit>().movePrevious(); itemBuilder: (BuildContext context, int index) {
} return AnimatedSwitcher(
}, duration: const Duration(milliseconds: 300),
child: Scaffold( child: pageNavigation.elementAt(index),
appBar: StandardAppBar(notifyParent: refresh), );
extendBodyBehindAppBar: false, },
body: BlocBuilder<BottomNavCubit, int>( pagination: SwiperPagination(
builder: (BuildContext context, int state) { builder: SwiperCustomPagination(
return AnimatedSwitcher( builder: (BuildContext context, SwiperPluginConfig config) {
duration: const Duration(milliseconds: 300), return BottomNavBar(swipeController: config.controller);
child: pageNavigation.elementAt(state), },
); ),
},
), ),
bottomNavigationBar: const BottomNavBar(), onIndexChanged: (newPageIndex) {
backgroundColor: Theme.of(context).colorScheme.background, BlocProvider.of<BottomNavCubit>(context).updateIndex(newPageIndex);
},
outer: true,
loop: false,
), ),
backgroundColor: Theme.of(context).colorScheme.background,
); );
}, },
), ),
......
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_swipe/flutter_swipe.dart';
import 'package:ionicons/ionicons.dart'; import 'package:ionicons/ionicons.dart';
import 'package:scrobbles/cubit/bottom_nav_cubit.dart'; import 'package:scrobbles/cubit/bottom_nav_cubit.dart';
class BottomNavBar extends StatelessWidget { class BottomNavBar extends StatelessWidget {
const BottomNavBar({super.key}); const BottomNavBar({super.key, required this.swipeController});
final SwiperController swipeController;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card( return Card(
margin: const EdgeInsets.only(top: 1, right: 4, left: 4), margin: const EdgeInsets.only(
top: 1,
right: 0,
left: 0,
),
elevation: 4, elevation: 4,
shadowColor: Theme.of(context).colorScheme.shadow, shadowColor: Theme.of(context).colorScheme.shadow,
color: Theme.of(context).colorScheme.surfaceVariant, color: Theme.of(context).colorScheme.surfaceVariant,
...@@ -25,7 +32,10 @@ class BottomNavBar extends StatelessWidget { ...@@ -25,7 +32,10 @@ class BottomNavBar extends StatelessWidget {
builder: (BuildContext context, int state) { builder: (BuildContext context, int state) {
return BottomNavigationBar( return BottomNavigationBar(
currentIndex: state, currentIndex: state,
onTap: (int index) => context.read<BottomNavCubit>().updateIndex(index), onTap: (int index) {
context.read<BottomNavCubit>().updateIndex(index);
swipeController.move(index);
},
type: BottomNavigationBarType.fixed, type: BottomNavigationBarType.fixed,
elevation: 0, elevation: 0,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
......
...@@ -45,10 +45,10 @@ packages: ...@@ -45,10 +45,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.2" version: "1.18.0"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
...@@ -101,10 +101,10 @@ packages: ...@@ -101,10 +101,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: fl_chart name: fl_chart
sha256: "6b9eb2b3017241d05c482c01f668dd05cc909ec9a0114fdd49acd958ff2432fa" sha256: "5a74434cc83bf64346efb562f1a06eefaf1bcb530dc3d96a104f631a1eff8d79"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.64.0" version: "0.65.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
...@@ -123,6 +123,14 @@ packages: ...@@ -123,6 +123,14 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_swipe:
dependency: "direct main"
description:
name: flutter_swipe
sha256: dc6541bac3a0545ce15a3fa15913f6250532062960bf6b0ad4562d02f14a8545
url: "https://pub.dev"
source: hosted
version: "1.0.1"
flutter_web_plugins: flutter_web_plugins:
dependency: transitive dependency: transitive
description: flutter description: flutter
...@@ -188,10 +196,10 @@ packages: ...@@ -188,10 +196,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.1" version: "1.10.0"
nested: nested:
dependency: transitive dependency: transitive
description: description:
...@@ -268,18 +276,18 @@ packages: ...@@ -268,18 +276,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.6" version: "2.1.7"
provider: provider:
dependency: transitive dependency: transitive
description: description:
name: provider name: provider
sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.0.5" version: "6.1.1"
shared_preferences: shared_preferences:
dependency: transitive dependency: transitive
description: description:
...@@ -324,10 +332,10 @@ packages: ...@@ -324,10 +332,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_web name: shared_preferences_web
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.2"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
...@@ -401,18 +409,18 @@ packages: ...@@ -401,18 +409,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: web name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.4-beta" version: "0.3.0"
win32: win32:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" sha256: "7c99c0e1e2fa190b48d25c81ca5e42036d5cac81430ef249027d97b0935c553f"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.0.9" version: "5.1.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
...@@ -422,5 +430,5 @@ packages: ...@@ -422,5 +430,5 @@ packages:
source: hosted source: hosted
version: "1.0.3" version: "1.0.3"
sdks: sdks:
dart: ">=3.1.0-185.0.dev <4.0.0" dart: ">=3.2.0 <4.0.0"
flutter: ">=3.7.0" flutter: ">=3.16.0"
...@@ -3,7 +3,7 @@ description: Display scrobbles data and charts ...@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
publish_to: 'none' publish_to: 'none'
version: 0.0.29+29 version: 0.0.31+31
environment: environment:
sdk: '^3.0.0' sdk: '^3.0.0'
...@@ -14,13 +14,14 @@ dependencies: ...@@ -14,13 +14,14 @@ dependencies:
easy_localization: ^3.0.1 easy_localization: ^3.0.1
equatable: ^2.0.5 equatable: ^2.0.5
fl_chart: ^0.64.0 fl_chart: ^0.65.0
flutter_bloc: ^8.1.1 flutter_bloc: ^8.1.1
http: ^1.1.0 http: ^1.1.0
path_provider: ^2.0.11 path_provider: ^2.0.11
hydrated_bloc: ^9.0.0 hydrated_bloc: ^9.0.0
ionicons: ^0.2.2 ionicons: ^0.2.2
unicons: ^2.1.1 unicons: ^2.1.1
flutter_swipe: ^1.0.1
flutter: flutter:
uses-material-design: false uses-material-design: false
......