mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
initial commit
This commit is contained in:
36
lib/foundation/context.dart
Normal file
36
lib/foundation/context.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app_page_route.dart';
|
||||
|
||||
extension Navigation on BuildContext {
|
||||
void pop<T>([T? result]) {
|
||||
if(mounted) {
|
||||
Navigator.of(this).pop(result);
|
||||
}
|
||||
}
|
||||
|
||||
bool canPop() {
|
||||
return Navigator.of(this).canPop();
|
||||
}
|
||||
|
||||
Future<T?> to<T>(Widget Function() builder) {
|
||||
return Navigator.of(this)
|
||||
.push<T>(AppPageRoute(builder: (context) => builder()));
|
||||
}
|
||||
|
||||
double get width => MediaQuery.of(this).size.width;
|
||||
|
||||
double get height => MediaQuery.of(this).size.height;
|
||||
|
||||
EdgeInsets get padding => MediaQuery.of(this).padding;
|
||||
|
||||
EdgeInsets get viewInsets => MediaQuery.of(this).viewInsets;
|
||||
|
||||
ColorScheme get colorScheme => Theme.of(this).colorScheme;
|
||||
|
||||
Brightness get brightness => Theme.of(this).brightness;
|
||||
|
||||
void showMessage({required String message}) {
|
||||
// TODO: show message
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user