You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/extensions/context_extension.dart

37 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
5 months ago
import 'package:test_sa/controllers/providers/api/user_provider.dart';
4 months ago
import 'package:test_sa/extensions/widget_extensions.dart';
10 months ago
import 'package:test_sa/new_views/swipe_module/dialoge/confirm_dialog.dart';
import '../controllers/providers/settings/setting_provider.dart';
extension BuildContextExtension on BuildContext {
AppLocalizations get translation => AppLocalizations.of(this)!;
List<String> get getIssues => [translation.reason1, translation.reason2, translation.reason3, translation.reason4, translation.reason5];
4 months ago
bool get isDark => Provider.of<SettingProvider>(this).theme == "dark";
2 years ago
bool get isAr => Provider.of<SettingProvider>(this).language == "ar";
10 months ago
SettingProvider get settingProvider => Provider.of<SettingProvider>(this, listen: false);
4 months ago
5 months ago
UserProvider get userProvider => Provider.of<UserProvider>(this, listen: false);
10 months ago
void showConfirmDialog(String message, {String? title, VoidCallback? onTap}) => showDialog(
context: this,
builder: (BuildContext cxt) => ConfirmDialog(message: message, onTap: onTap, title: title),
10 months ago
);
4 months ago
4 months ago
Future showBottomSheet(Widget childWidget, {bool? isDismissible, String? title}) => showModalBottomSheet(
4 months ago
context: this,
useSafeArea: true,
isScrollControlled: true,
isDismissible: true,
backgroundColor: Colors.transparent,
builder: (context) => SingleChildScrollView(padding: const EdgeInsets.all(0), child: childWidget.bottomSafeArea).bottomSheetContainerNew(context, title: title),
);
}