Sonnat Project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

1 year ago
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_bloc/flutter_bloc.dart';
  3. import 'package:sonnat/core/theme/cubit/theme_cubit.dart';
  4. extension ContextExtentions on BuildContext {
  5. double get height {
  6. return MediaQuery.of(this).size.height;
  7. }
  8. double get width {
  9. return MediaQuery.of(this).size.width;
  10. }
  11. Container get horizontalDivider {
  12. return Container(
  13. height: 2,
  14. margin: const EdgeInsets.symmetric(horizontal: 16),
  15. width: width,
  16. color: theme.colors.primary80.withOpacity(0.05),
  17. );
  18. }
  19. Container get verticalDivider {
  20. return Container(
  21. height: 12,
  22. width: 1,
  23. color: theme.colors.primary80.withOpacity(0.05),
  24. );
  25. }
  26. ThemeCubit get theme {
  27. return read<ThemeCubit>();
  28. }
  29. Future<dynamic> push(Widget page) async {
  30. await Navigator.push(this, MaterialPageRoute(builder: (_) => page));
  31. }
  32. Future<dynamic> pushNamed(String name) async {
  33. await Navigator.pushNamed(this, name);
  34. }
  35. Future<dynamic> pushReplacement(Widget page) async {
  36. await Navigator.pushReplacement(this, MaterialPageRoute(builder: (_) => page));
  37. }
  38. Future<void> pop(Widget page, [result]) async {
  39. Navigator.pop(this, result);
  40. }
  41. }