swipe to navigate patient view

This commit is contained in:
2024-11-08 10:22:10 +02:00
parent 09f5e94f00
commit 653f592849

View File

@@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swipe_detector/flutter_swipe_detector.dart';
import 'package:patient_manager/mih_packages/patient_profile/patient_details.dart'; import 'package:patient_manager/mih_packages/patient_profile/patient_details.dart';
import 'package:patient_manager/mih_packages/patient_profile/patient_files.dart'; import 'package:patient_manager/mih_packages/patient_profile/patient_files.dart';
import 'package:patient_manager/mih_packages/patient_profile/patient_notes.dart'; import 'package:patient_manager/mih_packages/patient_profile/patient_notes.dart';
@@ -244,7 +245,24 @@ class _PatientViewState extends State<PatientView> {
height = size.height; height = size.height;
}); });
checkScreenSize(); checkScreenSize();
return MIHLayoutBuilder( return SwipeDetector(
onSwipeLeft: (offset) {
if (_selectedIndex < 2) {
setState(() {
_selectedIndex += 1;
});
}
//print("swipe left");
},
onSwipeRight: (offset) {
if (_selectedIndex > 0) {
setState(() {
_selectedIndex -= 1;
});
}
//print("swipe right");
},
child: MIHLayoutBuilder(
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
secondaryActionButton: null, secondaryActionButton: null,
@@ -254,6 +272,7 @@ class _PatientViewState extends State<PatientView> {
bottomNavBar: null, bottomNavBar: null,
pullDownToRefresh: false, pullDownToRefresh: false,
onPullDown: () async {}, onPullDown: () async {},
),
); );
// return Scaffold( // return Scaffold(
// body: SafeArea( // body: SafeArea(