Skip to content
Snippets Groups Projects
Commit 166fe523 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '38-swipe-to-navigate' into 'master'

Resolve "Swipe to navigate"

Closes #38

See merge request !36
parents 5d677b31 956d7e3a
Branches
Tags Release_1.0.28_29
1 merge request!36Resolve "Swipe to navigate"
Pipeline #4552 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=1.0.27
app.versionCode=28
app.versionName=1.0.28
app.versionCode=29
......@@ -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 < 3) ? state + 1 : state);
void getDemoPage() => emit(0);
void getGraphPage() => emit(1);
void getSettingsPage() => emit(2);
......
......@@ -33,6 +33,16 @@ class _SkeletonScreenState extends State<SkeletonScreen> {
create: (BuildContext context) => SettingsCubit(),
child: BlocProvider<BottomNavCubit>(
create: (BuildContext context) => BottomNavCubit(),
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(
extendBodyBehindAppBar: false,
appBar: StandardAppBar(),
......@@ -40,12 +50,16 @@ class _SkeletonScreenState extends State<SkeletonScreen> {
builder: (BuildContext context, int state) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
child: pageNavigation.elementAt(state));
child: pageNavigation.elementAt(state),
);
},
),
bottomNavigationBar: const BottomNavBar(),
backgroundColor: Theme.of(context).colorScheme.background,
),
);
},
),
),
);
}
......
......@@ -21,7 +21,8 @@ class BottomNavBar extends StatelessWidget {
topRight: Radius.circular(16),
),
),
child: BlocBuilder<BottomNavCubit, int>(builder: (BuildContext context, int state) {
child: BlocBuilder<BottomNavCubit, int>(
builder: (BuildContext context, int state) {
return BottomNavigationBar(
currentIndex: state,
onTap: (int index) => context.read<BottomNavCubit>().updateIndex(index),
......@@ -49,7 +50,8 @@ class BottomNavBar extends StatelessWidget {
),
],
);
}),
},
),
);
}
}
......@@ -3,7 +3,7 @@ description: A random application, for testing purpose only.
publish_to: 'none'
version: 1.0.27+28
version: 1.0.28+29
environment:
sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment