Skip to content

Instantly share code, notes, and snippets.

@VB10
Created April 3, 2020 00:45
Show Gist options
  • Save VB10/7e176360f580f43d7cf4645b7640a16c to your computer and use it in GitHub Desktop.
Save VB10/7e176360f580f43d7cf4645b7640a16c to your computer and use it in GitHub Desktop.
Shoppi - BaseState
import 'package:flutter/material.dart';
import 'package:shoppingapp/core/constants/app_constants.dart';
import 'package:shoppingapp/core/constants/app_strings.dart';
abstract class BaseState<T extends StatefulWidget> extends State<T> {
ThemeData get currentTheme => Theme.of(context);
AppStrings get appStrings => AppStrings.instance;
AppConstants get appConstants => AppConstants.instance;
double dynamicHeight(double val) => MediaQuery.of(context).size.height * val;
double dynamicWidth(double val) => MediaQuery.of(context).size.width * val;
EdgeInsets insetsAll(double val) => EdgeInsets.all(dynamicHeight(val));
EdgeInsets insetHorizontal(double val) =>
EdgeInsets.symmetric(horizontal: dynamicHeight(val));
EdgeInsets insetVertical(double val) =>
EdgeInsets.symmetric(horizontal: dynamicHeight(val));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment