Added scrollbar

This commit is contained in:
Juan Gilsanz Polo 2024-01-26 21:38:21 +01:00
parent 91e3ea44f6
commit 74a4f65924

View file

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:timezone/timezone.dart' as tz; import 'package:timezone/timezone.dart' as tz;
import 'package:timezone/data/latest.dart' as tz; import 'package:timezone/data/latest.dart' as tz;
@ -20,6 +22,8 @@ class BlockingScheduleModal extends StatefulWidget {
} }
class _BlockingScheduleModalState extends State<BlockingScheduleModal> { class _BlockingScheduleModalState extends State<BlockingScheduleModal> {
final _weekdaysScrollController = ScrollController();
String? _timezone; String? _timezone;
List<String> _weekdays = []; List<String> _weekdays = [];
TimeOfDay? _from; TimeOfDay? _from;
@ -103,6 +107,8 @@ class _BlockingScheduleModalState extends State<BlockingScheduleModal> {
: null; : null;
return Dialog( return Dialog(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 500),
child: Padding( child: Padding(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
child: Column( child: Column(
@ -156,8 +162,18 @@ class _BlockingScheduleModalState extends State<BlockingScheduleModal> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
SizedBox( SizedBox(
height: 50, height: Platform.isMacOS || Platform.isLinux || Platform.isWindows ? 66 : 50,
child: Scrollbar(
controller: _weekdaysScrollController,
thumbVisibility: Platform.isMacOS || Platform.isLinux || Platform.isWindows,
interactive: Platform.isMacOS || Platform.isLinux || Platform.isWindows,
thickness: Platform.isMacOS || Platform.isLinux || Platform.isWindows ? 8 : 0,
child: Padding(
padding: EdgeInsets.only(
bottom: Platform.isMacOS || Platform.isLinux || Platform.isWindows ? 16 : 0
),
child: ListView( child: ListView(
controller: _weekdaysScrollController,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: [ children: [
FilterChip( FilterChip(
@ -204,6 +220,8 @@ class _BlockingScheduleModalState extends State<BlockingScheduleModal> {
], ],
), ),
), ),
),
),
const SizedBox(height: 16), const SizedBox(height: 16),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@ -291,6 +309,7 @@ class _BlockingScheduleModalState extends State<BlockingScheduleModal> {
], ],
), ),
), ),
),
); );
} }
} }