I am creating an app where user can add record. There is a modal bottom sheet which allow user to add their record. When they press add record the modal bottom sheet closes and I reset the text fields and tab Controller. But the issue is how to check if the user not added the record and just close the modal bottom sheet by dragging down without adding record. I am looking for solution to check if user drag the modal bottom sheet by dragging down
here is my code:
showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.white,
elevation: 15,
context: context,
builder: (BuildContext context) {
return StatefulBuilder(
builder:
(BuildContext context, StateSetter setState) {
return SingleChildScrollView(
padding: EdgeInsets.only(
top: 10,
bottom: MediaQuery.of(context)
.viewInsets
.bottom),
child: Column(
children: [
const SizedBox(
height: 10,
),
Image.asset('assets/bottomSheetBar.png'),
const SizedBox(
height: 20,
),
TabBar(
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: AppColors.mainColor,
controller: _tabController,
unselectedLabelColor:
AppColors.lightTextColor,
tabs: [
Tab(
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
'assets/expense_tab_logo.png'),
const SizedBox(
width: 10,
),
const Text(
'Expense',
style: TextStyle(
color: AppColors
.expenseColor),
),
],
),
),
Tab(
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
'assets/income_tab_logo.png'),
const SizedBox(
width: 10,
),
const Text(
'Income',
style: TextStyle(
color: AppColors
.incomeColor),
),
],
),
),
],
),
SizedBox(
height: 440,
child: TabBarView(
controller: _tabController,
children: [
showExpenseTabContent(setState),
showIncomeTabContent(setState),
],
),
),
],
),
);
},
);
},
);
Any solution to check if user close the modal bottom sheet by drag so i can perform the required action.