mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
93 lines
2.8 KiB
Dart
93 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/bottom_sheet/bottom_sheet_widget.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/bottom_sheet/custom_bottom_sheet.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
extension ContextExtension on BuildContext {
|
|
Future<void> goTo(String newRouteName) async {
|
|
// go(newRouteName);
|
|
await Navigator.pushNamed(this, newRouteName);
|
|
}
|
|
|
|
double get width => MediaQuery.sizeOf(this).width;
|
|
|
|
double get height => MediaQuery.sizeOf(this).height;
|
|
|
|
InputDecorationTheme get inputDecoration =>
|
|
Theme.of(this).inputDecorationTheme;
|
|
|
|
TextStyle get displayLarge => Theme.of(this).textTheme.displayLarge!;
|
|
|
|
TextStyle get displayMedium => Theme.of(this).textTheme.displayMedium!;
|
|
|
|
TextStyle get displaySmall => Theme.of(this).textTheme.displaySmall!;
|
|
|
|
TextStyle get titleLarge => Theme.of(this).textTheme.titleLarge!;
|
|
|
|
TextStyle get titleMedium => Theme.of(this).textTheme.titleMedium!;
|
|
|
|
TextStyle get titleSmall => Theme.of(this).textTheme.titleSmall!;
|
|
|
|
TextStyle get bodyLarge => Theme.of(this).textTheme.bodyLarge!;
|
|
|
|
TextStyle get bodyMedium => Theme.of(this).textTheme.bodyMedium!;
|
|
|
|
TextStyle get bodySmall => Theme.of(this).textTheme.bodySmall!;
|
|
|
|
void customBottomSheet({
|
|
/// this fild will show the title after image widget
|
|
required String title,
|
|
|
|
/// this showing image in top of the screen
|
|
String? image,
|
|
|
|
/// this if you need change image size
|
|
double? imageSize,
|
|
|
|
/// if you need change title styling use this fild
|
|
TextStyle? titleStyle,
|
|
|
|
/// this fild will show the title after title widget
|
|
String? descreption,
|
|
|
|
/// if you neee change descreption styling use this fild
|
|
TextStyle? descreptionStyle,
|
|
|
|
/// if you need show back bottom to closed bottom sheet
|
|
bool? withBack,
|
|
|
|
/// this calling when press action bottom
|
|
void Function()? onPressed,
|
|
|
|
/// this fild to change on press text
|
|
String? onPressedTitle,
|
|
|
|
/// this fild to change action bottom color
|
|
Color? onPressedColor,
|
|
|
|
/// this fild to change back bottom color
|
|
Color? backColor,
|
|
}) {
|
|
showModalBottomSheet<void>(
|
|
context: this,
|
|
isScrollControlled: true,
|
|
builder: (BuildContext context) {
|
|
return CustomBottomSheet(
|
|
child: CustomBottomSheetWidget(
|
|
image: image ?? '',
|
|
imageSize: imageSize ?? 200,
|
|
titleStyle: titleStyle,
|
|
description: descreption ?? '',
|
|
descreptionStyle: descreptionStyle,
|
|
title: title,
|
|
withBack: withBack ?? false,
|
|
onPressed: onPressed,
|
|
onPressedColor: onPressedColor ?? ColorsManager.primaryTextColor,
|
|
backColor: backColor,
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|