claude refactorings, flutter best practices, platform dependent changes, general cleanup
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import 'package:bottom_sheet/bottom_sheet.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void showAppointmentBottomSheet(
|
||||
BuildContext context, {
|
||||
required Widget Function(BuildContext context) header,
|
||||
required SliverChildListDelegate Function(BuildContext context) body,
|
||||
}) {
|
||||
showStickyFlexibleBottomSheet(
|
||||
minHeight: 0,
|
||||
initHeight: 0.4,
|
||||
maxHeight: 0.7,
|
||||
anchors: [0, 0.4, 0.7],
|
||||
isSafeArea: true,
|
||||
maxHeaderHeight: 100,
|
||||
context: context,
|
||||
headerBuilder: (context, _) => header(context),
|
||||
bodyBuilder: (context, _) => body(context),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void showAppointmentBottomSheet(
|
||||
BuildContext context, {
|
||||
required Widget Function(BuildContext context) header,
|
||||
required SliverChildListDelegate Function(BuildContext context) body,
|
||||
}) {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
builder: (sheetContext) => DraggableScrollableSheet(
|
||||
expand: false,
|
||||
initialChildSize: 0.4,
|
||||
minChildSize: 0.2,
|
||||
maxChildSize: 0.7,
|
||||
snap: true,
|
||||
snapSizes: const [0.4],
|
||||
builder: (_, scrollController) => CustomScrollView(
|
||||
controller: scrollController,
|
||||
slivers: [
|
||||
SliverPersistentHeader(
|
||||
pinned: true,
|
||||
delegate: _StickyHeader(child: header(sheetContext)),
|
||||
),
|
||||
SliverList(delegate: body(sheetContext)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _StickyHeader extends SliverPersistentHeaderDelegate {
|
||||
_StickyHeader({required this.child});
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
double get minExtent => 100;
|
||||
@override
|
||||
double get maxExtent => 100;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) => Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: SizedBox.expand(child: child),
|
||||
);
|
||||
|
||||
@override
|
||||
bool shouldRebuild(covariant _StickyHeader oldDelegate) => oldDelegate.child != child;
|
||||
}
|
||||
@@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:rrule/rrule.dart';
|
||||
|
||||
import '../../../../api/mhsl/customTimetableEvent/customTimetableEvent.dart';
|
||||
import '../../../../api/mhsl/custom_timetable_event/custom_timetable_event.dart';
|
||||
import '../../../../widget/centered_leading.dart';
|
||||
import '../../../../widget/debug/debug_tile.dart';
|
||||
import '../custom_events/custom_event_edit_dialog.dart';
|
||||
import '_bottom_sheet.dart';
|
||||
import 'bottom_sheet.dart';
|
||||
import 'delete_custom_event.dart';
|
||||
|
||||
class CustomEventSheet {
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../api/mhsl/customTimetableEvent/customTimetableEvent.dart';
|
||||
import '../../../../api/mhsl/custom_timetable_event/custom_timetable_event.dart';
|
||||
import '../../../../state/app/modules/timetable/bloc/timetable_bloc.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
|
||||
import '../../../../api/webuntis/queries/getRooms/getRoomsResponse.dart';
|
||||
import '../../../../api/webuntis/queries/getSubjects/getSubjectsResponse.dart';
|
||||
import '../../../../api/webuntis/queries/getTimetable/getTimetableResponse.dart';
|
||||
import '../../../../api/webuntis/queries/get_rooms/get_rooms_response.dart';
|
||||
import '../../../../api/webuntis/queries/get_subjects/get_subjects_response.dart';
|
||||
import '../../../../api/webuntis/queries/get_timetable/get_timetable_response.dart';
|
||||
import '../../../../routing/app_routes.dart';
|
||||
import '../../../../state/app/modules/timetable/bloc/timetable_bloc.dart';
|
||||
import '../../../../state/app/modules/timetable/bloc/timetable_state.dart';
|
||||
import '../../../../widget/debug/debug_tile.dart';
|
||||
import '../../../../widget/unimplemented_dialog.dart';
|
||||
import '_bottom_sheet.dart';
|
||||
import 'bottom_sheet.dart';
|
||||
|
||||
class WebuntisLessonSheet {
|
||||
static void show(BuildContext context, TimetableBloc bloc, Appointment appointment, GetTimetableResponseObject lesson) {
|
||||
|
||||
Reference in New Issue
Block a user