From 41b1baedc332981604dc205bcb6586d2db4183aa Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 23 Nov 2020 15:48:03 +0800 Subject: [PATCH] add screenutil support --- example/lib/main.dart | 5 ++++- example/pubspec.lock | 7 +++++++ lib/ansu_ui.dart | 1 + pubspec.lock | 7 +++++++ pubspec.yaml | 4 +--- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index f8468fc..f7bce79 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/buttons/as_button.dart'; import 'package:flutter/material.dart'; @@ -6,9 +7,10 @@ void main() { } class MyApp extends StatelessWidget { - // This widget is the root of your application. @override Widget build(BuildContext context) { + ScreenUtil.init(context, + designSize: Size(750, 1334), allowFontScaling: false); return MaterialApp( title: 'Flutter Demo', theme: ThemeData( @@ -60,6 +62,7 @@ class _MyHomePageState extends State { body: ListView( children: [ ASButton(), + SizedBox(height: 12.w), ], ), ); diff --git a/example/pubspec.lock b/example/pubspec.lock index 00475b0..3debf10 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -69,6 +69,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_screenutil: + dependency: transitive + description: + name: flutter_screenutil + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.0" flutter_test: dependency: "direct dev" description: flutter diff --git a/lib/ansu_ui.dart b/lib/ansu_ui.dart index 0be0113..eaa905d 100644 --- a/lib/ansu_ui.dart +++ b/lib/ansu_ui.dart @@ -1,3 +1,4 @@ library ansu_ui; export 'buttons/as_button.dart'; +export 'package:flutter_screenutil/flutter_screenutil.dart'; diff --git a/pubspec.lock b/pubspec.lock index d3431d8..708b7b9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -55,6 +55,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_screenutil: + dependency: "direct main" + description: + name: flutter_screenutil + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.0" flutter_test: dependency: "direct dev" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 515a9ca..8e6c041 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,6 @@ name: ansu_ui description: A new Flutter package. version: 0.0.1 author: -homepage: environment: sdk: ">=2.7.0 <3.0.0" @@ -11,6 +10,7 @@ environment: dependencies: flutter: sdk: flutter + flutter_screenutil: ^3.2.0 dev_dependencies: flutter_test: @@ -21,7 +21,6 @@ dev_dependencies: # The following section is specific to Flutter. flutter: - # To add assets to your package, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg @@ -32,7 +31,6 @@ flutter: # # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. - # To add custom fonts to your package, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a