Skip to content

Commit

Permalink
Improved modal bottom sheet scoll
Browse files Browse the repository at this point in the history
  • Loading branch information
JGeek00 committed Oct 2, 2022
1 parent 72eba31 commit 0a35fce
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 98 deletions.
196 changes: 99 additions & 97 deletions lib/screens/logs/filter_status_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
Widget build(BuildContext context) {
final logsProvider = Provider.of<LogsProvider>(context);

final height = MediaQuery.of(context).size.height;

void apply() async {
logsProvider.setSelectedResultStatus(selectedResultStatus);

Expand Down Expand Up @@ -79,107 +81,107 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
);
}

return DraggableScrollableSheet(
initialChildSize: 0.7,
minChildSize: 0.2,
maxChildSize: 0.7,
builder: (context, scrollController) => Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(28),
topRight: Radius.circular(28)
),
color: Theme.of(context).dialogBackgroundColor
return Container(
height: height >= 680 == true
? 680
: height-25,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(28),
topRight: Radius.circular(28)
),
child: Column(
children: [
const Padding(
padding: EdgeInsets.only(
top: 24,
bottom: 20,
),
child: Icon(
Icons.shield_rounded,
size: 26,
),
color: Theme.of(context).dialogBackgroundColor
),
child: Column(
children: [
const Padding(
padding: EdgeInsets.only(
top: 24,
bottom: 20,
),
Text(
AppLocalizations.of(context)!.responseStatus,
style: const TextStyle(
fontSize: 24
),
child: Icon(
Icons.shield_rounded,
size: 26,
),
const SizedBox(height: 20),
Expanded(
child: ListView(
controller: scrollController,
children: [
filterStatusListItem(
id: "all",
icon: Icons.shield_rounded,
label: AppLocalizations.of(context)!.all,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "filtered",
icon: Icons.shield_rounded,
label: AppLocalizations.of(context)!.filtered,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "processed",
icon: Icons.verified_user_rounded,
label: AppLocalizations.of(context)!.processed,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "whitelisted",
icon: Icons.verified_user_rounded,
label: AppLocalizations.of(context)!.processedWhitelist,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "blocked",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blocked,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "blocked_safebrowsing",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blockedSafeBrowsing,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "blocked_parental",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blockedParental,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "safe_search",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blockedSafeSearch,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),

],
),
),
Text(
AppLocalizations.of(context)!.responseStatus,
style: const TextStyle(
fontSize: 24
),
Padding(
padding: const EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: apply,
child: Text(AppLocalizations.of(context)!.apply)
)
],
),
)
],
),
),
const SizedBox(height: 20),
Expanded(
child: ListView(
physics: height >= 680 == true
? const NeverScrollableScrollPhysics()
: null,
children: [
filterStatusListItem(
id: "all",
icon: Icons.shield_rounded,
label: AppLocalizations.of(context)!.all,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "filtered",
icon: Icons.shield_rounded,
label: AppLocalizations.of(context)!.filtered,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "processed",
icon: Icons.verified_user_rounded,
label: AppLocalizations.of(context)!.processed,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "whitelisted",
icon: Icons.verified_user_rounded,
label: AppLocalizations.of(context)!.processedWhitelist,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "blocked",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blocked,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "blocked_safebrowsing",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blockedSafeBrowsing,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "blocked_parental",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blockedParental,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),
filterStatusListItem(
id: "safe_search",
icon: Icons.gpp_bad_rounded,
label: AppLocalizations.of(context)!.blockedSafeSearch,
onChanged: (value) => setState(() => selectedResultStatus = value!)
),

],
),
),
Padding(
padding: const EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: apply,
child: Text(AppLocalizations.of(context)!.apply)
)
],
),
)
],
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/logs/log_details_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LogDetailsModal extends StatelessWidget {

return DraggableScrollableSheet(
initialChildSize: 0.6,
minChildSize: 0.4,
minChildSize: 0.6,
maxChildSize: 0.95,
builder: (context, controller) => Container(
decoration: BoxDecoration(
Expand Down

0 comments on commit 0a35fce

Please sign in to comment.