diff --git a/.github/workflows/code_analysis.yml b/.github/workflows/code_analysis.yml new file mode 100644 index 0000000..5a5f58d --- /dev/null +++ b/.github/workflows/code_analysis.yml @@ -0,0 +1,24 @@ +name: Test Code + +# Controls when the workflow will run +on: + # Triggers + pull_request: + branches: [ "master" ] + push: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + flutter_analyze: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + - run: flutter pub get + - run: flutter analyze + - run: flutter test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..dc06500 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish Release + +on: + release: + types: [published] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Install Flutter + uses: subosito/flutter-action@v2 + + - name: Install dependencies + run: flutter pub get + + - name: Check Publish Warnings + run: dart pub publish --dry-run + + - name: Publish Package + uses: k-paxian/dart-package-publisher@master + with: + credentialJson: ${{ secrets.PUB_CREDENTIALS }} + flutter: true + skipTests: true diff --git a/.gitignore b/.gitignore index 446ed0d..4d7cb87 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ build/ ios/.generated/ ios/Flutter/Generated.xcconfig ios/Runner/GeneratedPluginRegistrant.* +.fvm +.vscode \ No newline at end of file diff --git a/.idea/NewGradientAppBar.iml b/.idea/NewGradientAppBar.iml deleted file mode 100644 index 08d6bda..0000000 --- a/.idea/NewGradientAppBar.iml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml deleted file mode 100644 index a616ed9..0000000 --- a/.idea/libraries/Dart_Packages.xml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml deleted file mode 100644 index f531cdf..0000000 --- a/.idea/libraries/Dart_SDK.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml deleted file mode 100644 index b0f6971..0000000 --- a/.idea/libraries/Flutter_Plugins.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 9dfda75..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index eef0ee1..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1614861218854 - - - 1614861833328 - - - 1614862157652 - - - 1614863469555 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b7d873a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -sudo: false - -language: dart - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - libstdc++6 - - fonts-droid-fallback - -install: -- git clone https://github.com/flutter/flutter.git -b beta -- ./flutter/bin/flutter doctor - -script: -- ./flutter/bin/flutter test -- ./flutter/bin/flutter test example - -cache: - directories: - - $HOME/.pub-cache - -deploy: - provider: script - script: ./tool/publish.sh - on: - branch: master - tags: true diff --git a/CHANGELOG.md b/CHANGELOG.md index d227a26..95283fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [0.3.1] - 27 June 2023 + + - minor changes + +## [0.3.0] - 27 June 2023 + + - Create separate package from fork + - Rename package to `flutter_gradient_app_bar` + - Rename `NewGradientAppBar` widget to `GradientAppBar` + - Add support for **Flutter 3.10.0** and **Dart 3** + - Migrate example app to AndroidX + ## [0.2.0] - April 2021 - Update Dart 2.12.0 [#1](https://github.com/GUIKAR741/NewGradientAppBar/pull/1) @@ -12,19 +24,19 @@ - Update to nullsafety - Update package name -## [0.1.3] - 15 Juli 2019 +## [0.1.3] - 15 July 2019 - Remove obsolete import -## [0.1.2] - 15 Juli 2019 +## [0.1.2] - 15 July 2019 - Updated description -## [0.1.1] - 15 Juli 2019 +## [0.1.1] - 15 July 2019 - Update the testing app -## [0.1.0] - 14 Juli 2019 +## [0.1.0] - 14 July 2019 - [BREAKING] Changed way of adding the gradient with using the gradient directly instead of making a LinearGradient in app diff --git a/README.md b/README.md index d09f295..4ae9016 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# New Gradient App Bar - -Love the material AppBar? Do you want to add more color to the appbar? Here's a newGradientAppBar. +# Flutter Gradient App Bar +> This is a fork of [new_gradient_app_bar](https://github.com/GUIKAR741/NewGradientAppBar), but with Flutter 3.10/Dart 3 support. If you're still using Flutter 2.x, use the original package. + +Love the material AppBar? Do you want to add more color to the appbar? Here's a GradientAppBar. It works just like the normal AppBar. Also with actions, back buttons, titles. So it's just your normal AppBar, but with a twist! @@ -12,17 +13,23 @@ It works just like the normal AppBar. Also with actions, back buttons, titles. S ## Getting Started -1. Depend on it by adding this to your pubspec.yaml file: ```new_gradient_app_bar: ^0.1.4``` - -2. Import it: ```import 'package:new_gradient_app_bar/new_gradient_app_bar.dart'``` - -3. Replace your current AppBar (In the scaffold) to NewGradientAppBar. - +1. Install the dependency: +``` + $ flutter pub add flutter_gradient_app_bar +``` +4. Import the package: ``` -appBar: NewGradientAppBar( +import 'package:flutter_gradient_app_bar/flutter_gradient_app_bar.dart' +``` + +5. Replace your Scaffold AppBar with GradientAppBar. +```dart +appBar: GradientAppBar( title: Text('Flutter'), - gradient: LinearGradient(colors: [Colors.blue, Colors.purple, Colors.red]) + gradient: LinearGradient( + colors: [Colors.blue, Colors.purple, Colors.red], + ), ), ``` diff --git a/example/.idea/libraries/Dart_SDK.xml b/example/.idea/libraries/Dart_SDK.xml deleted file mode 100644 index 896efb4..0000000 --- a/example/.idea/libraries/Dart_SDK.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/example/.idea/libraries/Flutter_for_Android.xml b/example/.idea/libraries/Flutter_for_Android.xml deleted file mode 100644 index 6ec9e41..0000000 --- a/example/.idea/libraries/Flutter_for_Android.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/example/.idea/modules.xml b/example/.idea/modules.xml deleted file mode 100644 index bd4a393..0000000 --- a/example/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/example/.idea/runConfigurations/main_dart.xml b/example/.idea/runConfigurations/main_dart.xml deleted file mode 100644 index aab7b5c..0000000 --- a/example/.idea/runConfigurations/main_dart.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/example/.idea/workspace.xml b/example/.idea/workspace.xml deleted file mode 100644 index 5b3388c..0000000 --- a/example/.idea/workspace.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index c28c5c7..ba42eab 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 31 lintOptions { disable 'InvalidPackage' diff --git a/example/android/build.gradle b/example/android/build.gradle index d4225c7..94a3494 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:7.1.2' } } @@ -24,6 +24,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 8bd86f6..94adc3a 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1 +1,3 @@ org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 9372d0f..cc5527d 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh old mode 100644 new mode 100755 index 8fd36ee..d37cd5e --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,13 +1,13 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=C:\src\flutter\flutter" -export "FLUTTER_APPLICATION_PATH=F:\apps\NewGradientAppBar\example" -export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_ROOT=/Users/bezzo/fvm/versions/3.3.10" +export "FLUTTER_APPLICATION_PATH=/Users/bezzo/Desktop/flutter_gradient_appbar/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build\ios" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/example/lib/main.dart b/example/lib/main.dart index 8107cb4..3b35b65 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:new_gradient_app_bar/new_gradient_app_bar.dart'; +import 'package:flutter_gradient_app_bar/flutter_gradient_app_bar.dart'; void main() => runApp(MyApp()); @@ -39,7 +39,7 @@ class _MyHomePageState extends State { return DefaultTabController( length: 2, child: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: Text(widget.title), gradient: LinearGradient(colors: [Colors.red, Colors.purple]), bottom: TabBar(tabs: [ @@ -62,7 +62,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.titleSmall, ), ], ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 2a949b8..947a8c6 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,47 +21,40 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.2" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_gradient_app_bar: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.3.1" flutter_test: dependency: "direct dev" description: flutter @@ -73,28 +66,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" - new_gradient_app_bar: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.2.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -106,7 +99,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -127,34 +120,27 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 63fba89..834a3cb 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -14,14 +14,12 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - new_gradient_app_bar: - path: ../../NewGradientAppBar + flutter_gradient_app_bar: + path: ../ + flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 dev_dependencies: flutter_test: diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart deleted file mode 100644 index 2c2b24a..0000000 --- a/example/test/widget_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// This is a basic Flutter widget test. -// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter -// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to -// find child widgets in the widget tree, read text, and verify that the values of widget properties -// are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import '../lib/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(new MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/lib/new_gradient_app_bar.dart b/lib/flutter_gradient_app_bar.dart similarity index 92% rename from lib/new_gradient_app_bar.dart rename to lib/flutter_gradient_app_bar.dart index c6b3e4c..e5c2bbd 100644 --- a/lib/new_gradient_app_bar.dart +++ b/lib/flutter_gradient_app_bar.dart @@ -1,4 +1,4 @@ -library new_gradient_app_bar; +library flutter_gradient_app_bar; import 'dart:math' as math; @@ -6,10 +6,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; -const double _kLeadingWidth = - kToolbarHeight; // So the leading button is square. +const double _kLeadingWidth = kToolbarHeight; // Bottom justify the kToolbarHeight child which may overflow the top. class _ToolbarContainerLayout extends SingleChildLayoutDelegate { @@ -34,12 +32,6 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate { bool shouldRelayout(_ToolbarContainerLayout oldDelegate) => false; } -// TODO(eseidel): Toolbar needs to change size based on orientation: -// https://material.io/design/components/app-bars-top.html#specs -// Mobile Landscape: 48dp -// Mobile Portrait: 56dp -// Tablet/Desktop: 64dp - /// A material design app bar. /// /// An app bar consists of a toolbar and potentially other widgets, such as a @@ -50,7 +42,7 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate { /// /// App bars are typically used in the [Scaffold.appBar] property, which places /// the app bar as a fixed-height widget at the top of the screen. For a scrollable -/// app bar, see [SliverNewGradientAppBar], which embeds an [NewGradientAppBar] in a sliver for use in +/// app bar, see [SliverGradientAppBar], which embeds an [GradientAppBar] in a sliver for use in /// a [CustomScrollView]. /// /// When not used as [Scaffold.appBar], or when wrapped in a [Hero], place the app @@ -68,7 +60,7 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate { /// the title is between them. The bottom is, naturally, at the bottom, and the /// flexibleSpace is behind all of them.](https://flutter.github.io/assets-for-api-docs/assets/material/app_bar.png) /// -/// If the [leading] widget is omitted, but the [NewGradientAppBar] is in a [Scaffold] with +/// If the [leading] widget is omitted, but the [GradientAppBar] is in a [Scaffold] with /// a [Drawer], then a button will be inserted to open the drawer. Otherwise, if /// the nearest [Navigator] has any previous routes, a [BackButton] is inserted /// instead. This behavior can be turned off by setting the [automaticallyImplyLeading] @@ -77,7 +69,7 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate { /// /// {@tool snippet --template=stateless_widget_material} /// -/// This sample shows an [NewGradientAppBar] with two simple actions. The first action +/// This sample shows an [GradientAppBar] with two simple actions. The first action /// opens a [SnackBar], while the second action navigates to a new page. /// /// ```dart preamble @@ -139,17 +131,17 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate { /// /// See also: /// -/// * [Scaffold], which displays the [NewGradientAppBar] in its [Scaffold.appBar] slot. -/// * [SliverNewGradientAppBar], which uses [NewGradientAppBar] to provide a flexible app bar that +/// * [Scaffold], which displays the [GradientAppBar] in its [Scaffold.appBar] slot. +/// * [SliverGradientAppBar], which uses [GradientAppBar] to provide a flexible app bar that /// can be used in a [CustomScrollView]. -/// * [TabBar], which is typically placed in the [bottom] slot of the [NewGradientAppBar] +/// * [TabBar], which is typically placed in the [bottom] slot of the [GradientAppBar] /// if the screen has multiple pages arranged in tabs. /// * [IconButton], which is used with [actions] to show buttons on the app bar. /// * [PopupMenuButton], to show a popup menu on the app bar, via [actions]. /// * [FlexibleSpaceBar], which is used with [flexibleSpace] when the app bar /// can expand and collapse. /// * -class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { +class GradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// Creates a material design app bar. /// /// The arguments [primary], [toolbarOpacity], [bottomOpacity] @@ -162,7 +154,7 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// then the default specified in the property's documentation will be used. /// /// Typically used in the [Scaffold.appBar] property. - NewGradientAppBar({ + GradientAppBar({ Key? key, this.leading, this.automaticallyImplyLeading = true, @@ -190,10 +182,10 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// A widget to display before the [title]. /// /// If this is null and [automaticallyImplyLeading] is set to true, the - /// [NewGradientAppBar] will imply an appropriate widget. For example, if the [NewGradientAppBar] is + /// [GradientAppBar] will imply an appropriate widget. For example, if the [GradientAppBar] is /// in a [Scaffold] that also has a [Drawer], the [Scaffold] will fill this /// widget with an [IconButton] that opens the drawer (using [Icons.menu]). If - /// there's no [Drawer] and the parent [Navigator] can go back, the [NewGradientAppBar] + /// there's no [Drawer] and the parent [Navigator] can go back, the [GradientAppBar] /// will use a [BackButton] that calls [Navigator.maybePop]. /// /// {@tool sample} @@ -224,7 +216,7 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// /// See also: /// - /// * [Scaffold.appBar], in which an [NewGradientAppBar] is usually placed. + /// * [Scaffold.appBar], in which an [GradientAppBar] is usually placed. /// * [Scaffold.drawer], in which the [Drawer] is usually placed. final Widget? leading; @@ -251,9 +243,9 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// This widget is stacked behind the toolbar and the tab bar. It's height will /// be the same as the app bar's overall height. /// - /// A flexible space isn't actually flexible unless the [NewGradientAppBar]'s container - /// changes the [NewGradientAppBar]'s size. A [SliverNewGradientAppBar] in a [CustomScrollView] - /// changes the [NewGradientAppBar]'s height when scrolled. + /// A flexible space isn't actually flexible unless the [GradientAppBar]'s container + /// changes the [GradientAppBar]'s size. A [SliverGradientAppBar] in a [CustomScrollView] + /// changes the [GradientAppBar]'s height when scrolled. /// /// Typically a [FlexibleSpaceBar]. See [FlexibleSpaceBar] for details. final Widget? flexibleSpace; @@ -295,7 +287,7 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// The gradient displayed at the appbar. /// /// If this property is null, then [ThemeData.appBarTheme.brightness] is used, - /// if that is also null, then [ThemeData.primaryColorBrightness] is used. + /// if that is also null, then [ThemeData.brightness] is used. final Brightness? brightness; /// The color, opacity, and size to use for app bar icons. Typically this @@ -345,7 +337,7 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// A value of 1.0 is fully opaque, and a value of 0.0 is fully transparent. /// /// Typically, this value is not changed from its default value (1.0). It is - /// used by [SliverNewGradientAppBar] to animate the opacity of the toolbar when the app + /// used by [SliverGradientAppBar] to animate the opacity of the toolbar when the app /// bar is scrolled. final double toolbarOpacity; @@ -354,7 +346,7 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { /// A value of 1.0 is fully opaque, and a value of 0.0 is fully transparent. /// /// Typically, this value is not changed from its default value (1.0). It is - /// used by [SliverNewGradientAppBar] to animate the opacity of the toolbar when the app + /// used by [SliverGradientAppBar] to animate the opacity of the toolbar when the app /// bar is scrolled. final double bottomOpacity; @@ -384,10 +376,10 @@ class NewGradientAppBar extends StatefulWidget implements PreferredSizeWidget { } @override - _NewGradientAppBarState createState() => _NewGradientAppBarState(); + _GradientAppBarState createState() => _GradientAppBarState(); } -class _NewGradientAppBarState extends State { +class _GradientAppBarState extends State { static const double _defaultElevation = 4.0; void _handleDrawerButton() { @@ -418,12 +410,12 @@ class _NewGradientAppBarState extends State { IconThemeData actionsIconTheme = widget.actionsIconTheme ?? appBarTheme.actionsIconTheme ?? overallIconTheme; - TextStyle centerStyle = (widget.textTheme?.headline6 ?? - appBarTheme.textTheme?.headline6 ?? - themeData.primaryTextTheme.headline6)!; - TextStyle? sideStyle = widget.textTheme?.bodyText2 ?? - appBarTheme.textTheme?.bodyText2 ?? - themeData.primaryTextTheme.bodyText2; + TextStyle? centerStyle = widget.textTheme?.titleLarge ?? + appBarTheme.titleTextStyle ?? + themeData.primaryTextTheme.titleLarge!; + TextStyle? sideStyle = widget.textTheme?.bodyMedium ?? + appBarTheme.toolbarTextStyle ?? + themeData.primaryTextTheme.bodyMedium; if (widget.toolbarOpacity != 1.0) { final double opacity = @@ -577,8 +569,8 @@ class _NewGradientAppBarState extends State { ); } final Brightness brightness = widget.brightness ?? - appBarTheme.brightness ?? - themeData.primaryColorBrightness; + appBarTheme.systemOverlayStyle?.statusBarBrightness ?? + themeData.brightness; final SystemUiOverlayStyle overlayStyle = brightness == Brightness.dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark; @@ -588,7 +580,7 @@ class _NewGradientAppBarState extends State { child: AnnotatedRegion( value: overlayStyle, child: Material( - color: appBarTheme.color ?? themeData.primaryColor, + color: appBarTheme.backgroundColor ?? themeData.primaryColor, elevation: widget.elevation ?? appBarTheme.elevation ?? _defaultElevation, shape: widget.shape, @@ -679,7 +671,7 @@ class _SliverGradientAppBarDelegate extends SliverPersistentHeaderDelegate { required this.pinned, required this.snapConfiguration, required this.shape, - }) : assert(primary || topPadding == 0.0), + }) : assert(primary || topPadding == 0.0), _bottomHeight = bottom.preferredSize.height; final Widget leading; @@ -741,7 +733,7 @@ class _SliverGradientAppBarDelegate extends SliverPersistentHeaderDelegate { maxExtent: maxExtent, currentExtent: math.max(minExtent, maxExtent - shrinkOffset), toolbarOpacity: toolbarOpacity, - child: NewGradientAppBar( + child: GradientAppBar( leading: leading, automaticallyImplyLeading: automaticallyImplyLeading, title: title, @@ -817,7 +809,7 @@ class _SliverGradientAppBarDelegate extends SliverPersistentHeaderDelegate { /// [CustomScrollView], which lets the app bar integrate with the scroll view so /// that it can vary in height according to the scroll offset or float above the /// other content in the scroll view. For a fixed-height app bar at the top of -/// the screen see [NewGradientAppBar], which is used in the [Scaffold.appBar] slot. +/// the screen see [GradientAppBar], which is used in the [Scaffold.appBar] slot. /// /// The GradientAppBar displays the toolbar widgets, [leading], [title], and /// [actions], above the [bottom] (if any). If a [flexibleSpace] widget is @@ -872,22 +864,22 @@ class _SliverGradientAppBarDelegate extends SliverPersistentHeaderDelegate { /// /// See also: /// -/// * [CustomScrollView], which integrates the [SliverNewGradientAppBar] into its +/// * [CustomScrollView], which integrates the [SliverGradientAppBar] into its /// scrolling. -/// * [NewGradientAppBar], which is a fixed-height app bar for use in [Scaffold.appBar]. -/// * [TabBar], which is typically placed in the [bottom] slot of the [NewGradientAppBar] +/// * [GradientAppBar], which is a fixed-height app bar for use in [Scaffold.appBar]. +/// * [TabBar], which is typically placed in the [bottom] slot of the [GradientAppBar] /// if the screen has multiple pages arranged in tabs. /// * [IconButton], which is used with [actions] to show buttons on the app bar. /// * [PopupMenuButton], to show a popup menu on the app bar, via [actions]. /// * [FlexibleSpaceBar], which is used with [flexibleSpace] when the app bar /// can expand and collapse. /// * -class SliverNewGradientAppBar extends StatefulWidget { +class SliverGradientAppBar extends StatefulWidget { /// Creates a material design app bar that can be placed in a [CustomScrollView]. /// /// The arguments [forceElevated], [primary], [floating], [pinned], [snap] /// and [automaticallyImplyLeading] must not be null. - const SliverNewGradientAppBar({ + const SliverGradientAppBar({ Key? key, this.leading, this.automaticallyImplyLeading = true, @@ -916,11 +908,11 @@ class SliverNewGradientAppBar extends StatefulWidget { /// A widget to display before the [title]. /// - /// If this is null and [automaticallyImplyLeading] is set to true, the [NewGradientAppBar] will - /// imply an appropriate widget. For example, if the [NewGradientAppBar] is in a [Scaffold] + /// If this is null and [automaticallyImplyLeading] is set to true, the [GradientAppBar] will + /// imply an appropriate widget. For example, if the [GradientAppBar] is in a [Scaffold] /// that also has a [Drawer], the [Scaffold] will fill this widget with an /// [IconButton] that opens the drawer. If there's no [Drawer] and the parent - /// [Navigator] can go back, the [NewGradientAppBar] will use a [BackButton] that calls + /// [Navigator] can go back, the [GradientAppBar] will use a [BackButton] that calls /// [Navigator.maybePop]. final Widget? leading; @@ -1000,10 +992,10 @@ class SliverNewGradientAppBar extends StatefulWidget { final double? elevation; /// Whether to show the shadow appropriate for the [elevation] even if the - /// content is not scrolled under the [NewGradientAppBar]. + /// content is not scrolled under the [GradientAppBar]. /// /// Defaults to false, meaning that the [elevation] is only applied when the - /// [NewGradientAppBar] is being displayed over content that is scrolled under it. + /// [GradientAppBar] is being displayed over content that is scrolled under it. /// /// When set to true, the [elevation] is applied regardless. /// @@ -1020,7 +1012,7 @@ class SliverNewGradientAppBar extends StatefulWidget { /// with [backgroundColor], [iconTheme], [textTheme]. /// /// If this property is null, then [ThemeData.appBarTheme.brightness] is used, - /// if that is also null, then [ThemeData.primaryColorBrightness] is used. + /// if that is also null, then [ThemeData.brightness] is used. final Brightness? brightness; /// The color, opacity, and size to use for app bar icons. Typically this @@ -1095,7 +1087,7 @@ class SliverNewGradientAppBar extends StatefulWidget { /// /// See also: /// - /// * [SliverNewGradientAppBar] for more animated examples of how this property changes the + /// * [SliverGradientAppBar] for more animated examples of how this property changes the /// behavior of the app bar in combination with [pinned] and [snap]. final bool floating; @@ -1116,7 +1108,7 @@ class SliverNewGradientAppBar extends StatefulWidget { /// /// See also: /// - /// * [SliverNewGradientAppBar] for more animated examples of how this property changes the + /// * [SliverGradientAppBar] for more animated examples of how this property changes the /// behavior of the app bar in combination with [floating]. final bool pinned; @@ -1149,18 +1141,17 @@ class SliverNewGradientAppBar extends StatefulWidget { /// /// See also: /// - /// * [SliverNewGradientAppBar] for more animated examples of how this property changes the + /// * [SliverGradientAppBar] for more animated examples of how this property changes the /// behavior of the app bar in combination with [pinned] and [floating]. final bool snap; @override - _SliverNewGradientAppBarState createState() => - _SliverNewGradientAppBarState(); + _SliverGradientAppBarState createState() => _SliverGradientAppBarState(); } // This class is only Stateful because it owns the TickerProvider used // by the floating appbar snap animation (via FloatingHeaderSnapConfiguration). -class _SliverNewGradientAppBarState extends State +class _SliverGradientAppBarState extends State with TickerProviderStateMixin { FloatingHeaderSnapConfiguration? _snapConfiguration; @@ -1182,7 +1173,7 @@ class _SliverNewGradientAppBarState extends State } @override - void didUpdateWidget(SliverNewGradientAppBar oldWidget) { + void didUpdateWidget(SliverGradientAppBar oldWidget) { super.didUpdateWidget(oldWidget); if (widget.snap != oldWidget.snap || widget.floating != oldWidget.floating) _updateSnapConfiguration(); diff --git a/pubspec.lock b/pubspec.lock index 49a0ce6..e15edce 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,35 +21,28 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -66,21 +59,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -92,7 +92,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -113,34 +113,27 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 108cbda..0c648ce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ -name: new_gradient_app_bar +name: flutter_gradient_app_bar description: The official AppBar, with a more colorful twist. Add gradients to spice up your application and make it beautiful. -version: 0.2.0 -homepage: https://github.com/GUIKAR741/NewGradientAppBar +version: 0.3.1 +homepage: https://github.com/shawn-grant/FlutterGradientAppBar dependencies: flutter: @@ -12,10 +12,7 @@ dev_dependencies: sdk: flutter environment: - sdk: '>=2.12.0 <3.0.0' - -# For information on the generic Dart part of this file, see the -# following page: https://www.dartlang.org/tools/pub/pubspec + sdk: '>=2.12.0 <4.0.0' # The following section is specific to Flutter. flutter: @@ -24,29 +21,3 @@ flutter: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg -# -# For details regarding assets in packages, see -# https://flutter.io/assets-and-images/#from-packages -# -# An image asset can refer to one or more resolution-specific "variants", see -# https://flutter.io/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 -# list giving the asset and other descriptors for the font. For -# example: -# fonts: -# - family: Schyler -# fonts: -# - asset: fonts/Schyler-Regular.ttf -# - asset: fonts/Schyler-Italic.ttf -# style: italic -# - family: Trajan Pro -# fonts: -# - asset: fonts/TrajanPro.ttf -# - asset: fonts/TrajanPro_Bold.ttf -# weight: 700 -# -# For details regarding fonts in packages, see -# https://flutter.io/custom-fonts/#from-packages diff --git a/test/new_gradient_app_bar_test.dart b/test/gradient_app_bar_test.dart similarity index 84% rename from test/new_gradient_app_bar_test.dart rename to test/gradient_app_bar_test.dart index df73574..8a9dca8 100644 --- a/test/new_gradient_app_bar_test.dart +++ b/test/gradient_app_bar_test.dart @@ -4,9 +4,9 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import './semantics_tester.dart'; -import '../lib/new_gradient_app_bar.dart'; +import '../lib/flutter_gradient_app_bar.dart'; -Widget buildSliverNewGradientAppBarApp( +Widget buildSliverGradientAppBarApp( {bool? floating, bool? pinned, double? expandedHeight, bool snap = false}) { return Localizations( locale: const Locale('en', 'US'), @@ -24,8 +24,8 @@ Widget buildSliverNewGradientAppBarApp( child: CustomScrollView( primary: true, slivers: [ - SliverNewGradientAppBar( - title: const Text('NewGradientAppBar Title'), + SliverGradientAppBar( + title: const Text('GradientAppBar Title'), floating: floating!, pinned: pinned!, expandedHeight: expandedHeight!, @@ -57,14 +57,13 @@ ScrollController? primaryScrollController(WidgetTester tester) { } double appBarHeight(WidgetTester tester) => - tester.getSize(find.byType(NewGradientAppBar, skipOffstage: false)).height; + tester.getSize(find.byType(GradientAppBar, skipOffstage: false)).height; double appBarTop(WidgetTester tester) => - tester.getTopLeft(find.byType(NewGradientAppBar, skipOffstage: false)).dy; + tester.getTopLeft(find.byType(GradientAppBar, skipOffstage: false)).dy; -double appBarBottom(WidgetTester tester) => tester - .getBottomLeft(find.byType(NewGradientAppBar, skipOffstage: false)) - .dy; +double appBarBottom(WidgetTester tester) => + tester.getBottomLeft(find.byType(GradientAppBar, skipOffstage: false)).dy; double tabBarHeight(WidgetTester tester) => tester.getSize(find.byType(TabBar, skipOffstage: false)).height; @@ -74,13 +73,13 @@ void main() { debugResetSemanticsIdCounter(); }); - testWidgets('NewGradientAppBar centers title on iOS', + testWidgets('GradientAppBar centers title on iOS', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(platform: TargetPlatform.android), home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: const Text('X'), ), ), @@ -99,7 +98,7 @@ void main() { MaterialApp( theme: ThemeData(platform: TargetPlatform.iOS), home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: const Text('X'), ), ), @@ -117,7 +116,7 @@ void main() { MaterialApp( theme: ThemeData(platform: TargetPlatform.iOS), home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: const Text('X'), actions: const [ Icon(Icons.thumb_up), @@ -138,7 +137,7 @@ void main() { MaterialApp( theme: ThemeData(platform: TargetPlatform.iOS), home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: const Text('X'), actions: const [ Icon(Icons.thumb_up), @@ -154,12 +153,12 @@ void main() { expect(center.dx, lessThan(400 - size.width / 2.0)); }); - testWidgets('NewGradientAppBar centerTitle:true centers on Android', + testWidgets('GradientAppBar centerTitle:true centers on Android', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( theme: ThemeData(platform: TargetPlatform.android), home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( centerTitle: true, title: const Text('X'), ), @@ -173,13 +172,12 @@ void main() { expect(center.dx, lessThan(400 + size.width / 2.0)); }); - testWidgets( - 'NewGradientAppBar centerTitle:false title start edge is 16.0 (LTR)', + testWidgets('GradientAppBar centerTitle:false title start edge is 16.0 (LTR)', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( centerTitle: false, title: const Placeholder(key: Key('X')), ), @@ -192,15 +190,14 @@ void main() { expect(tester.getTopRight(titleWidget).dx, 800 - 16.0); }); - testWidgets( - 'NewGradientAppBar centerTitle:false title start edge is 16.0 (RTL)', + testWidgets('GradientAppBar centerTitle:false title start edge is 16.0 (RTL)', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Directionality( textDirection: TextDirection.rtl, child: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( centerTitle: false, title: const Placeholder(key: Key('X')), ), @@ -214,13 +211,12 @@ void main() { expect(tester.getTopLeft(titleWidget).dx, 16.0); }); - testWidgets( - 'NewGradientAppBar titleSpacing:32 title start edge is 32.0 (LTR)', + testWidgets('GradientAppBar titleSpacing:32 title start edge is 32.0 (LTR)', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( centerTitle: false, titleSpacing: 32.0, title: const Placeholder(key: Key('X')), @@ -234,15 +230,14 @@ void main() { expect(tester.getTopRight(titleWidget).dx, 800 - 32.0); }); - testWidgets( - 'NewGradientAppBar titleSpacing:32 title start edge is 32.0 (RTL)', + testWidgets('GradientAppBar titleSpacing:32 title start edge is 32.0 (RTL)', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Directionality( textDirection: TextDirection.rtl, child: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( centerTitle: false, titleSpacing: 32.0, title: const Placeholder(key: Key('X')), @@ -258,12 +253,12 @@ void main() { }); testWidgets( - 'NewGradientAppBar centerTitle:false leading button title left edge is 72.0 (LTR)', + 'GradientAppBar centerTitle:false leading button title left edge is 72.0 (LTR)', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( centerTitle: false, title: const Text('X'), ), @@ -277,14 +272,14 @@ void main() { }); testWidgets( - 'NewGradientAppBar centerTitle:false leading button title left edge is 72.0 (RTL)', + 'GradientAppBar centerTitle:false leading button title left edge is 72.0 (RTL)', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Directionality( textDirection: TextDirection.rtl, child: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( centerTitle: false, title: const Text('X'), ), @@ -298,7 +293,7 @@ void main() { expect(tester.getTopRight(find.text('X')).dx, 800.0 - 72.0); }); - testWidgets('NewGradientAppBar centerTitle:false title overflow OK', + testWidgets('GradientAppBar centerTitle:false title overflow OK', (WidgetTester tester) async { // The app bar's title should be constrained to fit within the available space // between the leading and actions widgets. @@ -310,7 +305,7 @@ void main() { Widget buildApp() { return MaterialApp( home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( leading: leading, centerTitle: false, title: Container( @@ -357,7 +352,7 @@ void main() { - 200.0)); // Actions' width. - leading = Container(); // NewGradientAppBar will constrain the width to 24.0 + leading = Container(); // GradientAppBar will constrain the width to 24.0 await tester.pumpWidget(buildApp()); expect(tester.getTopLeft(title).dx, 72.0); // Adding a leading widget shouldn't effect the title's size @@ -365,7 +360,7 @@ void main() { equals(800.0 - 56.0 - 16.0 - 16.0 - 200.0)); }); - testWidgets('NewGradientAppBar centerTitle:true title overflow OK (LTR)', + testWidgets('GradientAppBar centerTitle:true title overflow OK (LTR)', (WidgetTester tester) async { // The app bar's title should be constrained to fit within the available space // between the leading and actions widgets. When it's also centered it may @@ -379,7 +374,7 @@ void main() { Widget buildApp() { return MaterialApp( home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( leading: leading, centerTitle: true, title: Container( @@ -418,7 +413,7 @@ void main() { expect(tester.getSize(title).width, equals(620.0)); }); - testWidgets('NewGradientAppBar centerTitle:true title overflow OK (RTL)', + testWidgets('GradientAppBar centerTitle:true title overflow OK (RTL)', (WidgetTester tester) async { // The app bar's title should be constrained to fit within the available space // between the leading and actions widgets. When it's also centered it may @@ -434,7 +429,7 @@ void main() { home: Directionality( textDirection: TextDirection.rtl, child: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( leading: leading, centerTitle: true, title: Container( @@ -474,13 +469,12 @@ void main() { expect(tester.getSize(title).width, equals(620.0)); }); - testWidgets('NewGradientAppBar with no Scaffold', - (WidgetTester tester) async { + testWidgets('GradientAppBar with no Scaffold', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: SizedBox( height: kToolbarHeight, - child: NewGradientAppBar( + child: GradientAppBar( leading: const Text('L'), title: const Text('No Scaffold'), actions: const [Text('A1'), Text('A2')], @@ -495,7 +489,7 @@ void main() { expect(find.text('A2'), findsOneWidget); }); - testWidgets('NewGradientAppBar render at zero size', + testWidgets('GradientAppBar render at zero size', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( @@ -504,7 +498,7 @@ void main() { height: 0.0, width: 0.0, child: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: const Text('X'), ), ), @@ -517,7 +511,7 @@ void main() { expect(tester.getSize(title).isEmpty, isTrue); }); - testWidgets('NewGradientAppBar actions are vertically centered', + testWidgets('GradientAppBar actions are vertically centered', (WidgetTester tester) async { final UniqueKey appBarKey = UniqueKey(); final UniqueKey leadingKey = UniqueKey(); @@ -528,7 +522,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( key: appBarKey, leading: SizedBox(key: leadingKey, height: 50.0), title: SizedBox(key: titleKey, height: 40.0), @@ -556,7 +550,7 @@ void main() { MaterialApp( theme: ThemeData(platform: TargetPlatform.android), home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: const Text('X'), ), drawer: @@ -576,7 +570,7 @@ void main() { MaterialApp( theme: ThemeData(platform: TargetPlatform.android), home: Scaffold( - appBar: NewGradientAppBar( + appBar: GradientAppBar( title: const Text('X'), actions: const [ IconButton( @@ -607,45 +601,45 @@ void main() { expect(tester.getSize(shareButton), const Size(48.0, 56.0)); }); - testWidgets('SliverNewGradientAppBar default configuration', + testWidgets('SliverGradientAppBar default configuration', (WidgetTester tester) async { - await tester.pumpWidget(buildSliverNewGradientAppBarApp( + await tester.pumpWidget(buildSliverGradientAppBarApp( floating: false, pinned: false, )); final ScrollController? controller = primaryScrollController(tester); expect(controller!.offset, 0.0); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); - final double initialNewGradientAppBarHeight = appBarHeight(tester); + final double initialGradientAppBarHeight = appBarHeight(tester); final double initialTabBarHeight = tabBarHeight(tester); // Scroll the not-pinned appbar partially out of view controller.jumpTo(50.0); await tester.pump(); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); - expect(appBarHeight(tester), initialNewGradientAppBarHeight); + expect(find.byType(SliverGradientAppBar), findsOneWidget); + expect(appBarHeight(tester), initialGradientAppBarHeight); expect(tabBarHeight(tester), initialTabBarHeight); // Scroll the not-pinned appbar out of view controller.jumpTo(600.0); await tester.pump(); - expect(find.byType(SliverNewGradientAppBar), findsNothing); - expect(appBarHeight(tester), initialNewGradientAppBarHeight); + expect(find.byType(SliverGradientAppBar), findsNothing); + expect(appBarHeight(tester), initialGradientAppBarHeight); expect(tabBarHeight(tester), initialTabBarHeight); // Scroll the not-pinned appbar back into view controller.jumpTo(0.0); await tester.pump(); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); - expect(appBarHeight(tester), initialNewGradientAppBarHeight); + expect(find.byType(SliverGradientAppBar), findsOneWidget); + expect(appBarHeight(tester), initialGradientAppBarHeight); expect(tabBarHeight(tester), initialTabBarHeight); }); - testWidgets('SliverNewGradientAppBar expandedHeight, pinned', + testWidgets('SliverGradientAppBar expandedHeight, pinned', (WidgetTester tester) async { - await tester.pumpWidget(buildSliverNewGradientAppBarApp( + await tester.pumpWidget(buildSliverGradientAppBarApp( floating: false, pinned: true, expandedHeight: 128.0, @@ -653,32 +647,32 @@ void main() { final ScrollController? controller = primaryScrollController(tester); expect(controller!.offset, 0.0); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); expect(appBarHeight(tester), 128.0); - const double initialNewGradientAppBarHeight = 128.0; + const double initialGradientAppBarHeight = 128.0; final double initialTabBarHeight = tabBarHeight(tester); // Scroll the not-pinned appbar, collapsing the expanded height. At this // point both the toolbar and the tabbar are visible. controller.jumpTo(600.0); await tester.pump(); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); expect(tabBarHeight(tester), initialTabBarHeight); - expect(appBarHeight(tester), lessThan(initialNewGradientAppBarHeight)); + expect(appBarHeight(tester), lessThan(initialGradientAppBarHeight)); expect(appBarHeight(tester), greaterThan(initialTabBarHeight)); // Scroll the not-pinned appbar back into view controller.jumpTo(0.0); await tester.pump(); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); - expect(appBarHeight(tester), initialNewGradientAppBarHeight); + expect(find.byType(SliverGradientAppBar), findsOneWidget); + expect(appBarHeight(tester), initialGradientAppBarHeight); expect(tabBarHeight(tester), initialTabBarHeight); }); - testWidgets('SliverNewGradientAppBar expandedHeight, pinned and floating', + testWidgets('SliverGradientAppBar expandedHeight, pinned and floating', (WidgetTester tester) async { - await tester.pumpWidget(buildSliverNewGradientAppBarApp( + await tester.pumpWidget(buildSliverGradientAppBarApp( floating: true, pinned: true, expandedHeight: 128.0, @@ -686,38 +680,38 @@ void main() { final ScrollController? controller = primaryScrollController(tester); expect(controller!.offset, 0.0); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); expect(appBarHeight(tester), 128.0); - const double initialNewGradientAppBarHeight = 128.0; + const double initialGradientAppBarHeight = 128.0; final double initialTabBarHeight = tabBarHeight(tester); // Scroll the floating-pinned appbar, collapsing the expanded height. At this // point only the tabBar is visible. controller.jumpTo(600.0); await tester.pump(); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); expect(tabBarHeight(tester), initialTabBarHeight); - expect(appBarHeight(tester), lessThan(initialNewGradientAppBarHeight)); + expect(appBarHeight(tester), lessThan(initialGradientAppBarHeight)); expect(appBarHeight(tester), initialTabBarHeight); // Scroll the floating-pinned appbar back into view controller.jumpTo(0.0); await tester.pump(); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); - expect(appBarHeight(tester), initialNewGradientAppBarHeight); + expect(find.byType(SliverGradientAppBar), findsOneWidget); + expect(appBarHeight(tester), initialGradientAppBarHeight); expect(tabBarHeight(tester), initialTabBarHeight); }); - testWidgets('SliverNewGradientAppBar expandedHeight, floating with snap:true', + testWidgets('SliverGradientAppBar expandedHeight, floating with snap:true', (WidgetTester tester) async { - await tester.pumpWidget(buildSliverNewGradientAppBarApp( + await tester.pumpWidget(buildSliverGradientAppBarApp( floating: true, pinned: false, snap: true, expandedHeight: 128.0, )); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); expect(appBarTop(tester), 0.0); expect(appBarHeight(tester), 128.0); expect(appBarBottom(tester), 128.0); @@ -727,7 +721,7 @@ void main() { tester.state(find.byType(Scrollable)).position; position.jumpTo(256.00); await tester.pumpAndSettle(); - expect(find.byType(SliverNewGradientAppBar), findsNothing); + expect(find.byType(SliverGradientAppBar), findsNothing); expect(appBarTop(tester), lessThanOrEqualTo(-128.0)); // Drag the scrollable up and down. The app bar should not snap open, its @@ -794,15 +788,15 @@ void main() { }); testWidgets( - 'SliverNewGradientAppBar expandedHeight, floating and pinned with snap:true', + 'SliverGradientAppBar expandedHeight, floating and pinned with snap:true', (WidgetTester tester) async { - await tester.pumpWidget(buildSliverNewGradientAppBarApp( + await tester.pumpWidget(buildSliverGradientAppBarApp( floating: true, pinned: true, snap: true, expandedHeight: 128.0, )); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); expect(appBarTop(tester), 0.0); expect(appBarHeight(tester), 128.0); expect(appBarBottom(tester), 128.0); @@ -813,7 +807,7 @@ void main() { tester.state(find.byType(Scrollable)).position; position.jumpTo(256.0); await tester.pumpAndSettle(); - expect(find.byType(SliverNewGradientAppBar), findsOneWidget); + expect(find.byType(SliverGradientAppBar), findsOneWidget); expect(appBarTop(tester), 0.0); expect(appBarHeight(tester), kTextTabBarHeight); @@ -882,7 +876,7 @@ void main() { expect(appBarBottom(tester), kTextTabBarHeight); }); - testWidgets('NewGradientAppBar dimensions, with and without bottom, primary', + testWidgets('GradientAppBar dimensions, with and without bottom, primary', (WidgetTester tester) async { const MediaQueryData topPadding100 = MediaQueryData(padding: EdgeInsets.only(top: 100.0)); @@ -899,7 +893,7 @@ void main() { data: topPadding100, child: Scaffold( primary: false, - appBar: NewGradientAppBar(), + appBar: GradientAppBar(), ), ), ), @@ -919,7 +913,7 @@ void main() { data: topPadding100, child: Scaffold( primary: true, - appBar: NewGradientAppBar(title: const Text('title')), + appBar: GradientAppBar(title: const Text('title')), ), ), ), @@ -940,7 +934,7 @@ void main() { data: topPadding100, child: Scaffold( primary: false, - appBar: NewGradientAppBar( + appBar: GradientAppBar( bottom: PreferredSize( preferredSize: const Size.fromHeight(200.0), child: Container(), @@ -965,7 +959,7 @@ void main() { data: topPadding100, child: Scaffold( primary: true, - appBar: NewGradientAppBar( + appBar: GradientAppBar( bottom: PreferredSize( preferredSize: const Size.fromHeight(200.0), child: Container(), @@ -989,7 +983,7 @@ void main() { textDirection: TextDirection.ltr, child: MediaQuery( data: topPadding100, - child: NewGradientAppBar( + child: GradientAppBar( primary: false, title: const Text('title'), ), @@ -1001,12 +995,12 @@ void main() { expect(tester.getTopLeft(find.text('title')).dy, lessThan(100.0)); }); - testWidgets('NewGradientAppBar updates when you add a drawer', + testWidgets('GradientAppBar updates when you add a drawer', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( - appBar: NewGradientAppBar(), + appBar: GradientAppBar(), ), ), ); @@ -1015,7 +1009,7 @@ void main() { MaterialApp( home: Scaffold( drawer: const Drawer(), - appBar: NewGradientAppBar(), + appBar: GradientAppBar(), ), ), ); @@ -1023,26 +1017,26 @@ void main() { }); testWidgets( - 'NewGradientAppBar does not draw menu for drawer if automaticallyImplyLeading is false', + 'GradientAppBar does not draw menu for drawer if automaticallyImplyLeading is false', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( drawer: const Drawer(), - appBar: NewGradientAppBar(automaticallyImplyLeading: false), + appBar: GradientAppBar(automaticallyImplyLeading: false), ), ), ); expect(find.byIcon(Icons.menu), findsNothing); }); - testWidgets('NewGradientAppBar handles loose children 0', + testWidgets('GradientAppBar handles loose children 0', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( home: Center( - child: NewGradientAppBar( + child: GradientAppBar( leading: Placeholder(key: key), title: const Text('Abc'), actions: const [ @@ -1063,13 +1057,13 @@ void main() { const Size(56.0, 56.0)); }); - testWidgets('NewGradientAppBar handles loose children 1', + testWidgets('GradientAppBar handles loose children 1', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( home: Center( - child: NewGradientAppBar( + child: GradientAppBar( leading: Placeholder(key: key), title: const Text('Abc'), actions: const [ @@ -1099,13 +1093,13 @@ void main() { const Size(56.0, 56.0)); }); - testWidgets('NewGradientAppBar handles loose children 2', + testWidgets('GradientAppBar handles loose children 2', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( home: Center( - child: NewGradientAppBar( + child: GradientAppBar( leading: Placeholder(key: key), title: const Text('Abc'), actions: const [ @@ -1146,13 +1140,13 @@ void main() { const Size(56.0, 56.0)); }); - testWidgets('NewGradientAppBar handles loose children 3', + testWidgets('GradientAppBar handles loose children 3', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( home: Center( - child: NewGradientAppBar( + child: GradientAppBar( leading: Placeholder(key: key), title: const Text('Abc'), actions: const [ @@ -1185,7 +1179,7 @@ void main() { }); testWidgets( - 'NewGradientAppBar positioning of leading and trailing widgets with top padding', + 'GradientAppBar positioning of leading and trailing widgets with top padding', (WidgetTester tester) async { const MediaQueryData topPadding100 = MediaQueryData(padding: EdgeInsets.only(top: 100.0)); @@ -1206,7 +1200,7 @@ void main() { data: topPadding100, child: Scaffold( primary: false, - appBar: NewGradientAppBar( + appBar: GradientAppBar( leading: Placeholder(key: leadingKey), title: Placeholder(key: titleKey), actions: [Placeholder(key: trailingKey)], @@ -1215,8 +1209,8 @@ void main() { ), ), )); - expect(tester.getTopLeft(find.byType(NewGradientAppBar)), - const Offset(0.0, 0.0)); + expect( + tester.getTopLeft(find.byType(GradientAppBar)), const Offset(0.0, 0.0)); expect(tester.getTopLeft(find.byKey(leadingKey)), const Offset(800.0 - 56.0, 100.0)); expect(tester.getTopLeft(find.byKey(titleKey)), const Offset(416.0, 100.0)); @@ -1225,7 +1219,7 @@ void main() { }); testWidgets( - 'SliverNewGradientAppBar positioning of leading and trailing widgets with top padding', + 'SliverGradientAppBar positioning of leading and trailing widgets with top padding', (WidgetTester tester) async { const MediaQueryData topPadding100 = MediaQueryData(padding: EdgeInsets.only(top: 100.0)); @@ -1247,7 +1241,7 @@ void main() { child: CustomScrollView( primary: true, slivers: [ - SliverNewGradientAppBar( + SliverGradientAppBar( leading: Placeholder(key: leadingKey), title: Placeholder(key: titleKey), actions: [Placeholder(key: trailingKey)], @@ -1257,8 +1251,8 @@ void main() { ), ), )); - expect(tester.getTopLeft(find.byType(NewGradientAppBar)), - const Offset(0.0, 0.0)); + expect( + tester.getTopLeft(find.byType(GradientAppBar)), const Offset(0.0, 0.0)); expect(tester.getTopLeft(find.byKey(leadingKey)), const Offset(800.0 - 56.0, 100.0)); expect(tester.getTopLeft(find.byKey(titleKey)), const Offset(416.0, 100.0)); @@ -1267,7 +1261,7 @@ void main() { }); testWidgets( - 'SliverNewGradientAppBar positioning of leading and trailing widgets with bottom padding', + 'SliverGradientAppBar positioning of leading and trailing widgets with bottom padding', (WidgetTester tester) async { const MediaQueryData topPadding100 = MediaQueryData(padding: EdgeInsets.only(top: 100.0, bottom: 50.0)); @@ -1289,7 +1283,7 @@ void main() { child: CustomScrollView( primary: true, slivers: [ - SliverNewGradientAppBar( + SliverGradientAppBar( leading: Placeholder(key: leadingKey), title: Placeholder(key: titleKey), actions: [Placeholder(key: trailingKey)], @@ -1299,7 +1293,7 @@ void main() { ), ), )); - expect(tester.getRect(find.byType(NewGradientAppBar)), + expect(tester.getRect(find.byType(GradientAppBar)), const Rect.fromLTRB(0.0, 0.0, 800.00, 100.0 + 56.0)); expect(tester.getRect(find.byKey(leadingKey)), const Rect.fromLTRB(800.0 - 56.0, 100.0, 800.0, 100.0 + 56.0)); @@ -1307,14 +1301,14 @@ void main() { const Rect.fromLTRB(0.0, 100.0, 400.0, 100.0 + 56.0)); }); - testWidgets('SliverNewGradientAppBar provides correct semantics in LTR', + testWidgets('SliverGradientAppBar provides correct semantics in LTR', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); await tester.pumpWidget( MaterialApp( home: Center( - child: NewGradientAppBar( + child: GradientAppBar( leading: const Text('Leading'), title: const Text('Title'), actions: const [ @@ -1387,7 +1381,7 @@ void main() { semantics.dispose(); }); - testWidgets('SliverNewGradientAppBar provides correct semantics in RTL', + testWidgets('SliverGradientAppBar provides correct semantics in RTL', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); @@ -1398,7 +1392,7 @@ void main() { child: Directionality( textDirection: TextDirection.rtl, child: Center( - child: NewGradientAppBar( + child: GradientAppBar( leading: const Text('Leading'), title: const Text('Title'), actions: const [ @@ -1478,18 +1472,17 @@ void main() { semantics.dispose(); }); - testWidgets( - 'NewGradientAppBar draws a light system bar for a dark background', + testWidgets('GradientAppBar draws a light system bar for a dark background', (WidgetTester tester) async { final ThemeData darkTheme = ThemeData.dark(); await tester.pumpWidget(MaterialApp( theme: darkTheme, home: Scaffold( - appBar: NewGradientAppBar(title: const Text('test')), + appBar: GradientAppBar(title: const Text('test')), ), )); - expect(darkTheme.primaryColorBrightness, Brightness.dark); + expect(darkTheme.brightness, Brightness.dark); expect( SystemChrome.latestStyle, const SystemUiOverlayStyle( @@ -1498,18 +1491,17 @@ void main() { )); }); - testWidgets( - 'NewGradientAppBar draws a dark system bar for a light background', + testWidgets('GradientAppBar draws a dark system bar for a light background', (WidgetTester tester) async { final ThemeData lightTheme = ThemeData(primaryColor: Colors.white); await tester.pumpWidget(MaterialApp( theme: lightTheme, home: Scaffold( - appBar: NewGradientAppBar(title: const Text('test')), + appBar: GradientAppBar(title: const Text('test')), ), )); - expect(lightTheme.primaryColorBrightness, Brightness.light); + expect(lightTheme.brightness, Brightness.light); expect( SystemChrome.latestStyle, const SystemUiOverlayStyle( @@ -1518,7 +1510,7 @@ void main() { )); }); - testWidgets('Changing SliverNewGradientAppBar snap from true to false', + testWidgets('Changing SliverGradientAppBar snap from true to false', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/17598 const double appBarHeight = 256.0; @@ -1531,7 +1523,7 @@ void main() { return Scaffold( body: CustomScrollView( slivers: [ - SliverNewGradientAppBar( + SliverGradientAppBar( expandedHeight: appBarHeight, pinned: false, floating: true, @@ -1581,10 +1573,10 @@ void main() { await tester.pump(); }); - testWidgets('NewGradientAppBar shape default', (WidgetTester tester) async { + testWidgets('GradientAppBar shape default', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( - home: NewGradientAppBar( + home: GradientAppBar( leading: const Text('L'), title: const Text('No Scaffold'), actions: const [Text('A1'), Text('A2')], @@ -1592,10 +1584,10 @@ void main() { ), ); - final Finder appBarFinder = find.byType(NewGradientAppBar); - NewGradientAppBar getNewGradientAppBarWidget(Finder finder) => - tester.widget(finder); - expect(getNewGradientAppBarWidget(appBarFinder).shape, null); + final Finder appBarFinder = find.byType(GradientAppBar); + GradientAppBar getGradientAppBarWidget(Finder finder) => + tester.widget(finder); + expect(getGradientAppBarWidget(appBarFinder).shape, null); final Finder materialFinder = find.byType(Material); Material getMaterialWidget(Finder finder) => @@ -1603,13 +1595,13 @@ void main() { expect(getMaterialWidget(materialFinder).shape, null); }); - testWidgets('NewGradientAppBar with shape', (WidgetTester tester) async { + testWidgets('GradientAppBar with shape', (WidgetTester tester) async { const RoundedRectangleBorder roundedRectangleBorder = RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(15.0))); await tester.pumpWidget( MaterialApp( - home: NewGradientAppBar( + home: GradientAppBar( leading: const Text('L'), title: const Text('No Scaffold'), actions: const [Text('A1'), Text('A2')], @@ -1618,11 +1610,10 @@ void main() { ), ); - final Finder appBarFinder = find.byType(NewGradientAppBar); - NewGradientAppBar getNewGradientAppBarWidget(Finder finder) => - tester.widget(finder); - expect( - getNewGradientAppBarWidget(appBarFinder).shape, roundedRectangleBorder); + final Finder appBarFinder = find.byType(GradientAppBar); + GradientAppBar getGradientAppBarWidget(Finder finder) => + tester.widget(finder); + expect(getGradientAppBarWidget(appBarFinder).shape, roundedRectangleBorder); final Finder materialFinder = find.byType(Material); Material getMaterialWidget(Finder finder) => @@ -1630,13 +1621,13 @@ void main() { expect(getMaterialWidget(materialFinder).shape, roundedRectangleBorder); }); - testWidgets('SliverNewGradientAppBar shape default', + testWidgets('SliverGradientAppBar shape default', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: CustomScrollView( slivers: [ - SliverNewGradientAppBar( + SliverGradientAppBar( leading: Text('L'), title: Text('No Scaffold'), actions: [Text('A1'), Text('A2')], @@ -1646,13 +1637,11 @@ void main() { ), ); - final Finder sliverNewGradientAppBarFinder = - find.byType(SliverNewGradientAppBar); - SliverNewGradientAppBar getSliverNewGradientAppBarWidget(Finder finder) => - tester.widget(finder); + final Finder sliverGradientAppBarFinder = find.byType(SliverGradientAppBar); + SliverGradientAppBar getSliverGradientAppBarWidget(Finder finder) => + tester.widget(finder); expect( - getSliverNewGradientAppBarWidget(sliverNewGradientAppBarFinder).shape, - null); + getSliverGradientAppBarWidget(sliverGradientAppBarFinder).shape, null); final Finder materialFinder = find.byType(Material); Material getMaterialWidget(Finder finder) => @@ -1660,8 +1649,7 @@ void main() { expect(getMaterialWidget(materialFinder).shape, null); }); - testWidgets('SliverNewGradientAppBar with shape', - (WidgetTester tester) async { + testWidgets('SliverGradientAppBar with shape', (WidgetTester tester) async { const RoundedRectangleBorder roundedRectangleBorder = RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(15.0)), @@ -1670,7 +1658,7 @@ void main() { const MaterialApp( home: CustomScrollView( slivers: [ - SliverNewGradientAppBar( + SliverGradientAppBar( leading: Text('L'), title: Text('No Scaffold'), actions: [Text('A1'), Text('A2')], @@ -1681,12 +1669,10 @@ void main() { ), ); - final Finder sliverNewGradientAppBarFinder = - find.byType(SliverNewGradientAppBar); - SliverNewGradientAppBar getSliverNewGradientAppBarWidget(Finder finder) => - tester.widget(finder); - expect( - getSliverNewGradientAppBarWidget(sliverNewGradientAppBarFinder).shape, + final Finder sliverGradientAppBarFinder = find.byType(SliverGradientAppBar); + SliverGradientAppBar getSliverGradientAppBarWidget(Finder finder) => + tester.widget(finder); + expect(getSliverGradientAppBarWidget(sliverGradientAppBarFinder).shape, roundedRectangleBorder); final Finder materialFinder = find.byType(Material); diff --git a/test/semantics_tester.dart b/test/semantics_tester.dart index 9f5ff30..d993c7e 100644 --- a/test/semantics_tester.dart +++ b/test/semantics_tester.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' show SemanticsFlag; +// import 'dart:ui' show SemanticsFlag; import 'package:flutter/foundation.dart'; import 'package:flutter/physics.dart'; @@ -689,7 +689,7 @@ class _HasSemantics extends Matcher { Description result = mismatchDescription .add('${matchState[TestSemantics]}\n') .add('Current SemanticsNode tree:\n') - .add(_indent((RendererBinding.instance?.renderView.debugSemantics + .add(_indent((RendererBinding.instance.renderView.debugSemantics ?.toStringDeep(childOrder: childOrder))!)) .add('\n') .add( diff --git a/tool/publish.sh b/tool/publish.sh deleted file mode 100755 index fa3709c..0000000 --- a/tool/publish.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -mkdir -p .pub-cache - -cat < ~/.pub-cache/credentials.json -{ - "accessToken":"$accessToken", - "refreshToken":"$refreshToken", - "tokenEndpoint":"$tokenEndpoint", - "scopes":["$scopes"], - "expiration":$expiration -} -EOF - -pub publish -f \ No newline at end of file