diff --git a/README.md b/README.md index e34d124..803865a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # ansu_ui 安速物流移动组件 -## dep +## dep 依赖 ![flutter_screenutil](https://img.shields.io/badge/flutter__screenutil-3.2.0-brightgreen) +![get](https://img.shields.io/badge/get-3.17.1-brightgreen) ## Getting Started diff --git a/example/lib/main.dart b/example/lib/main.dart index 2f64b85..d077444 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -55,6 +55,12 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { return ASScaffold( + leading: navigator.canPop() + ? IconButton( + icon: Icon(Icons.backpack, color: Colors.black), + onPressed: () {}, + ) + : SizedBox(), title: '安速组件', body: ListView( padding: EdgeInsets.all(16.w), diff --git a/lib/buttons/as_back_button.dart b/lib/buttons/as_back_button.dart index 91208c7..388f2a1 100644 --- a/lib/buttons/as_back_button.dart +++ b/lib/buttons/as_back_button.dart @@ -1,6 +1,7 @@ import 'package:ansu_ui/ansu_ui.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; ///安速返回按钮 /// @@ -17,7 +18,7 @@ class ASBackButton extends StatelessWidget { @override Widget build(BuildContext context) { - return Navigator.canPop(context) + return navigator.canPop() ? IconButton( icon: Icon( CupertinoIcons.chevron_back, diff --git a/lib/scaffold/as_scaffold.dart b/lib/scaffold/as_scaffold.dart index 2bca3e9..d39f659 100644 --- a/lib/scaffold/as_scaffold.dart +++ b/lib/scaffold/as_scaffold.dart @@ -27,7 +27,7 @@ class ASScaffold extends StatefulWidget { final PreferredSizeWidget appBarBottom; /// `EndDrawer` endDrawer - /// + /// /// 右方向的抽屉 final Widget endDrawer; ASScaffold({ @@ -54,7 +54,7 @@ class _ASScaffoldState extends State { appBar: AppBar( backgroundColor: kForegroundColor, elevation: 0, - leading: ASBackButton(), + leading: widget.leading ?? ASBackButton(), centerTitle: true, title: DefaultTextStyle( style: TextStyle( diff --git a/pubspec.lock b/pubspec.lock index 708b7b9..3d511dc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -67,6 +67,13 @@ packages: description: flutter source: sdk version: "0.0.0" + get: + dependency: "direct main" + description: + name: get + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.17.1" matcher: dependency: transitive description: @@ -150,5 +157,5 @@ packages: source: hosted version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.10.0-110 <2.11.0" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.17.0" diff --git a/pubspec.yaml b/pubspec.yaml index aa9dcf8..abe0607 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: flutter: sdk: flutter flutter_screenutil: ^3.2.0 + get: ^3.17.1 dev_dependencies: flutter_test: