From 028407c61545b4f3becfb6abe05d38a888af6edd Mon Sep 17 00:00:00 2001 From: Prajapati Chintan Date: Fri, 14 Jul 2023 11:35:57 +0530 Subject: [PATCH] Removed: flutter_screenutil --- ios/Podfile.lock | 2 +- lib/vaahextendflutter/base/base_stateful.dart | 40 ------------- .../base/base_stateless.dart | 28 --------- lib/vaahextendflutter/helpers/responsive.dart | 59 ------------------- lib/vaahextendflutter/helpers/styles.dart | 38 ++++++------ lib/views/pages/home.dart | 4 +- lib/views/pages/not_found.dart | 5 +- lib/views/pages/permission_denied.dart | 5 +- lib/views/pages/ui/index.dart | 4 +- pubspec.lock | 8 --- pubspec.yaml | 6 +- 11 files changed, 25 insertions(+), 174 deletions(-) delete mode 100644 lib/vaahextendflutter/base/base_stateful.dart delete mode 100644 lib/vaahextendflutter/base/base_stateless.dart delete mode 100644 lib/vaahextendflutter/helpers/responsive.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ab089fbe..e2695de2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -893,6 +893,6 @@ SPEC CHECKSUMS: Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 TweetNacl: 3abf4d1d2082b0114e7a67410e300892448951e6 -PODFILE CHECKSUM: fd03b9b6cdc465d56cc516cb052d645e1a9c1dff +PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b COCOAPODS: 1.12.1 diff --git a/lib/vaahextendflutter/base/base_stateful.dart b/lib/vaahextendflutter/base/base_stateful.dart deleted file mode 100644 index 9c3724fc..00000000 --- a/lib/vaahextendflutter/base/base_stateful.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../helpers/responsive.dart'; - -abstract class BaseStateful extends State - with DynamicSize { - // Context valid to create providers - @mustCallSuper - @protected - void initDependencies(BuildContext context) { - // eg. Connectivity controller (Which checks network connectivity) - } - - @protected - void afterFirstBuild(BuildContext context) {} - - @mustCallSuper - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) { - afterFirstBuild(context); - }); - } - - @override - void setState(VoidCallback fn) { - if (mounted) { - super.setState(fn); - } - } - - @mustCallSuper - @override - Widget build(BuildContext context) { - initDependencies(context); - initDynamicSize(context); - return const SizedBox(); - } -} diff --git a/lib/vaahextendflutter/base/base_stateless.dart b/lib/vaahextendflutter/base/base_stateless.dart deleted file mode 100644 index ac034992..00000000 --- a/lib/vaahextendflutter/base/base_stateless.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../helpers/responsive.dart'; - -abstract class BaseStateless extends StatelessWidget with DynamicSize { - const BaseStateless({super.key}); - - // Context valid to create controllers - @mustCallSuper - @protected - void initDependencies(BuildContext context) { - // eg. Connectivity controller - } - - @protected - void afterFirstBuild(BuildContext context) {} - - @mustCallSuper - @override - Widget build(BuildContext context) { - initDependencies(context); - initDynamicSize(context); - WidgetsBinding.instance.addPostFrameCallback((_) { - afterFirstBuild(context); - }); - return const SizedBox(); - } -} diff --git a/lib/vaahextendflutter/helpers/responsive.dart b/lib/vaahextendflutter/helpers/responsive.dart deleted file mode 100644 index 359adf80..00000000 --- a/lib/vaahextendflutter/helpers/responsive.dart +++ /dev/null @@ -1,59 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; - -// Usage: -// class _MyAppState extends State with DynamicSize { -// @override -// Widget build(BuildContext context) { -// initDynamicSize(context); -// return SizedBox(); -// } -// } - -// ApplySize: -// SizedBox( -// width: 300.wExt, // or swExt -// height: 200.hExt, // or shExt -// child: Text( -// 'demo', -// style: TextStyle( -// fontSize: 20.spExt, -// ), -// ), -// ); - -mixin DynamicSize { - // check for logical size of the device https://www.ios-resolution.com/ - void initDynamicSize(BuildContext context) { - ScreenUtil.init( - context, - designSize: const Size( - 390, // iPhone 13 logical width (in points) - 844, // iPhone 13 logical height (in points) - ), - ); - } -} - -// to import this file use the class given bellow, most of the IDE will automatically import this file. -class ImportScreenUtil {} - -// Extension for screen util -// To set differnt font size and different height and width of element based on devices. -// eg. fontSize: 20.spExt -extension SizeExtension on num { - // setWidth - double get wExt => w.toDouble(); - - // setHeight - double get hExt => h.toDouble(); - - // Set sp with default allowFontScalingSelf = false - double get spExt => sp.toDouble(); - - // % of screen width - double get swExt => sw.toDouble(); - - // % of screen height - double get shExt => sh.toDouble(); -} diff --git a/lib/vaahextendflutter/helpers/styles.dart b/lib/vaahextendflutter/helpers/styles.dart index 64dd5403..3ff08c28 100644 --- a/lib/vaahextendflutter/helpers/styles.dart +++ b/lib/vaahextendflutter/helpers/styles.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import './responsive.dart'; - class TextStyles { const TextStyles._(); @@ -142,27 +140,27 @@ class TextStyles { }; static final _fontSizes = { - TextSize.size0: 10.0.spExt, - TextSize.size1: 12.0.spExt, - TextSize.size2: 14.0.spExt, - TextSize.size3: 15.0.spExt, - TextSize.size4: 16.0.spExt, - TextSize.size5: 18.0.spExt, - TextSize.size6: 21.0.spExt, - TextSize.size7: 24.0.spExt, - TextSize.size8: 27.0.spExt, + TextSize.size0: 10.0, + TextSize.size1: 12.0, + TextSize.size2: 14.0, + TextSize.size3: 15.0, + TextSize.size4: 16.0, + TextSize.size5: 18.0, + TextSize.size6: 21.0, + TextSize.size7: 24.0, + TextSize.size8: 27.0, }; static final _lineHeights = { - TextSize.size0: 14.0.spExt, - TextSize.size1: 16.0.spExt, - TextSize.size2: 19.0.spExt, - TextSize.size3: 20.0.spExt, - TextSize.size4: 21.0.spExt, - TextSize.size5: 24.0.spExt, - TextSize.size6: 27.0.spExt, - TextSize.size7: 30.0.spExt, - TextSize.size8: 33.0.spExt, + TextSize.size0: 14.0, + TextSize.size1: 16.0, + TextSize.size2: 19.0, + TextSize.size3: 20.0, + TextSize.size4: 21.0, + TextSize.size5: 24.0, + TextSize.size6: 27.0, + TextSize.size7: 30.0, + TextSize.size8: 33.0, }; } diff --git a/lib/views/pages/home.dart b/lib/views/pages/home.dart index 6c19e1d9..5a404c98 100644 --- a/lib/views/pages/home.dart +++ b/lib/views/pages/home.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; -import '../../vaahextendflutter/base/base_stateful.dart'; import '../../vaahextendflutter/env.dart'; import '../../vaahextendflutter/services/notification/internal/notification_view.dart'; import 'ui/index.dart'; @@ -21,7 +20,7 @@ class HomePage extends StatefulWidget { State createState() => _HomePageState(); } -class _HomePageState extends BaseStateful { +class _HomePageState extends State { @override void initState() { super.initState(); @@ -30,7 +29,6 @@ class _HomePageState extends BaseStateful { @override Widget build(BuildContext context) { - super.build(context); return Scaffold( appBar: AppBar( actions: const [ diff --git a/lib/views/pages/not_found.dart b/lib/views/pages/not_found.dart index 6d1b1df7..2301a043 100644 --- a/lib/views/pages/not_found.dart +++ b/lib/views/pages/not_found.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; -import '../../vaahextendflutter/base/base_stateless.dart'; - -class NotFoundPage extends BaseStateless { +class NotFoundPage extends StatelessWidget { static const String routePath = '/page-not-found'; static Route route() { @@ -16,7 +14,6 @@ class NotFoundPage extends BaseStateless { @override Widget build(BuildContext context) { - super.build(context); return Scaffold( appBar: AppBar(), body: const Center( diff --git a/lib/views/pages/permission_denied.dart b/lib/views/pages/permission_denied.dart index 9b24a0d2..4950db38 100644 --- a/lib/views/pages/permission_denied.dart +++ b/lib/views/pages/permission_denied.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; -import '../../vaahextendflutter/base/base_stateless.dart'; - -class PermissionDeniedPage extends BaseStateless { +class PermissionDeniedPage extends StatelessWidget { static const String routePath = '/permission-denied'; static Route route() { @@ -16,7 +14,6 @@ class PermissionDeniedPage extends BaseStateless { @override Widget build(BuildContext context) { - super.build(context); return Scaffold( appBar: AppBar(), body: const Center( diff --git a/lib/views/pages/ui/index.dart b/lib/views/pages/ui/index.dart index ed6dcf36..c872b2de 100644 --- a/lib/views/pages/ui/index.dart +++ b/lib/views/pages/ui/index.dart @@ -4,7 +4,6 @@ import './components/buttons/buttons.dart'; import './components/inputs/inputs.dart'; import './components/themecolors.dart'; import '../../../vaahextendflutter/app_theme.dart'; -import '../../../vaahextendflutter/base/base_stateful.dart'; import '../../../vaahextendflutter/helpers/constants.dart'; class UIPage extends StatefulWidget { @@ -23,10 +22,9 @@ class UIPage extends StatefulWidget { State createState() => _UIPageState(); } -class _UIPageState extends BaseStateful { +class _UIPageState extends State { @override Widget build(BuildContext context) { - super.build(context); return Scaffold( backgroundColor: AppTheme.colors['black']?.shade100, appBar: AppBar( diff --git a/pubspec.lock b/pubspec.lock index cedeaee0..7639eae3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -358,14 +358,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.7" - flutter_screenutil: - dependency: "direct main" - description: - name: flutter_screenutil - sha256: "8e049ecdc1a62c90e6bf0e9c8398ace8dde81b92889c70cfe06281d79d59113a" - url: "https://pub.dev" - source: hosted - version: "5.6.1" flutter_test: dependency: "direct dev" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 7f0ec1be..4ee805d2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: vaahflutter description: VaahFlutter, essentials for every app. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 @@ -31,7 +31,6 @@ dependencies: get_storage: ^2.0.3 fluttertoast: ^8.1.3 file_picker: ^5.2.5 - flutter_screenutil: ^5.6.1 # Firebase firebase_dynamic_links: ^5.0.16 firebase_core: ^2.7.1 @@ -49,7 +48,6 @@ dev_dependencies: build_runner: ^2.3.3 flutter: - # below line allows you use Material Icons in application uses-material-design: true @@ -70,4 +68,4 @@ flutter: # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 \ No newline at end of file + # weight: 700