Improved modal bottom sheet scoll

This commit is contained in:
Juan Gilsanz Polo 2022-10-02 22:23:20 +02:00
parent 72eba31200
commit 0a35fcefc5
2 changed files with 100 additions and 98 deletions

View file

@ -29,6 +29,8 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final logsProvider = Provider.of<LogsProvider>(context); final logsProvider = Provider.of<LogsProvider>(context);
final height = MediaQuery.of(context).size.height;
void apply() async { void apply() async {
logsProvider.setSelectedResultStatus(selectedResultStatus); logsProvider.setSelectedResultStatus(selectedResultStatus);
@ -79,107 +81,107 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
); );
} }
return DraggableScrollableSheet( return Container(
initialChildSize: 0.7, height: height >= 680 == true
minChildSize: 0.2, ? 680
maxChildSize: 0.7, : height-25,
builder: (context, scrollController) => Container( decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: const BorderRadius.only(
borderRadius: const BorderRadius.only( topLeft: Radius.circular(28),
topLeft: Radius.circular(28), topRight: Radius.circular(28)
topRight: Radius.circular(28) ),
color: Theme.of(context).dialogBackgroundColor
),
child: Column(
children: [
const Padding(
padding: EdgeInsets.only(
top: 24,
bottom: 20,
),
child: Icon(
Icons.shield_rounded,
size: 26,
),
), ),
color: Theme.of(context).dialogBackgroundColor Text(
), AppLocalizations.of(context)!.responseStatus,
child: Column( style: const TextStyle(
children: [ fontSize: 24
const Padding(
padding: EdgeInsets.only(
top: 24,
bottom: 20,
),
child: Icon(
Icons.shield_rounded,
size: 26,
),
), ),
Text( ),
AppLocalizations.of(context)!.responseStatus, const SizedBox(height: 20),
style: const TextStyle( Expanded(
fontSize: 24 child: ListView(
), physics: height >= 680 == true
), ? const NeverScrollableScrollPhysics()
const SizedBox(height: 20), : null,
Expanded( children: [
child: ListView( filterStatusListItem(
controller: scrollController, id: "all",
children: [ icon: Icons.shield_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.all,
id: "all", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.shield_rounded, ),
label: AppLocalizations.of(context)!.all, filterStatusListItem(
onChanged: (value) => setState(() => selectedResultStatus = value!) id: "filtered",
), icon: Icons.shield_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.filtered,
id: "filtered", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.shield_rounded, ),
label: AppLocalizations.of(context)!.filtered, filterStatusListItem(
onChanged: (value) => setState(() => selectedResultStatus = value!) id: "processed",
), icon: Icons.verified_user_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.processed,
id: "processed", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.verified_user_rounded, ),
label: AppLocalizations.of(context)!.processed, filterStatusListItem(
onChanged: (value) => setState(() => selectedResultStatus = value!) id: "whitelisted",
), icon: Icons.verified_user_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.processedWhitelist,
id: "whitelisted", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.verified_user_rounded, ),
label: AppLocalizations.of(context)!.processedWhitelist, filterStatusListItem(
onChanged: (value) => setState(() => selectedResultStatus = value!) id: "blocked",
), icon: Icons.gpp_bad_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.blocked,
id: "blocked", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.gpp_bad_rounded, ),
label: AppLocalizations.of(context)!.blocked, filterStatusListItem(
onChanged: (value) => setState(() => selectedResultStatus = value!) id: "blocked_safebrowsing",
), icon: Icons.gpp_bad_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.blockedSafeBrowsing,
id: "blocked_safebrowsing", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.gpp_bad_rounded, ),
label: AppLocalizations.of(context)!.blockedSafeBrowsing, filterStatusListItem(
onChanged: (value) => setState(() => selectedResultStatus = value!) id: "blocked_parental",
), icon: Icons.gpp_bad_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.blockedParental,
id: "blocked_parental", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.gpp_bad_rounded, ),
label: AppLocalizations.of(context)!.blockedParental, filterStatusListItem(
onChanged: (value) => setState(() => selectedResultStatus = value!) id: "safe_search",
), icon: Icons.gpp_bad_rounded,
filterStatusListItem( label: AppLocalizations.of(context)!.blockedSafeSearch,
id: "safe_search", onChanged: (value) => setState(() => selectedResultStatus = value!)
icon: Icons.gpp_bad_rounded, ),
label: AppLocalizations.of(context)!.blockedSafeSearch,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
], ],
),
), ),
Padding( ),
padding: const EdgeInsets.all(20), Padding(
child: Row( padding: const EdgeInsets.all(20),
mainAxisAlignment: MainAxisAlignment.end, child: Row(
children: [ mainAxisAlignment: MainAxisAlignment.end,
TextButton( children: [
onPressed: apply, TextButton(
child: Text(AppLocalizations.of(context)!.apply) onPressed: apply,
) child: Text(AppLocalizations.of(context)!.apply)
], )
), ],
) ),
], )
), ],
), ),
); );
} }

View file

@ -32,7 +32,7 @@ class LogDetailsModal extends StatelessWidget {
return DraggableScrollableSheet( return DraggableScrollableSheet(
initialChildSize: 0.6, initialChildSize: 0.6,
minChildSize: 0.4, minChildSize: 0.6,
maxChildSize: 0.95, maxChildSize: 0.95,
builder: (context, controller) => Container( builder: (context, controller) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(