afonsocraposo / buttons_tabbar

A Flutter package that implements a TabBar where each label is a toggle button.
https://pub.dev/documentation/buttons_tabbar/latest/
MIT License
102 stars 32 forks source link

Error when building from Code #58

Closed fidelQabit closed 3 months ago

fidelQabit commented 3 months ago

Bug Report

Env:

[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Versi¢n 10.0.22621.3737], locale es-CU)
    • Flutter version 3.19.6 on channel stable at C:\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (2 months ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[√] Windows Version (Installed version of Windows is version 10 or higher)
== Building for Android ==

> flutter build appbundle --release --flavor development --target lib/main_development_remote.dart

Running Gradle task 'bundleDevelopmentRelease'...               
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

Checking the license for package Android SDK Platform 34 in /usr/local/share/android-sdk/licenses
License for package Android SDK Platform 34 accepted.
Preparing "Install Android SDK Platform 34 (revision: 3)".
"Install Android SDK Platform 34 (revision: 3)" ready.
Installing Android SDK Platform 34 in /usr/local/share/android-sdk/platforms/android-34
"Install Android SDK Platform 34 (revision: 3)" complete.
"Install Android SDK Platform 34 (revision: 3)" finished.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/builder/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.19/android/src/main/java/io/flutter/plugins/firebase/messaging/FlutterFirebaseMessagingPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/builder/.pub-cache/hosted/pub.dev/cloud_firestore-4.15.8/android/src/main/java/io/flutter/plugins/firebase/firestore/FlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/builder/.pub-cache/hosted/pub.dev/firebase_dynamic_links-5.4.17/android/src/main/java/io/flutter/plugins/firebase/dynamiclinks/Utils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/builder/.pub-cache/hosted/pub.dev/video_thumbnail-0.5.3/android/src/main/java/xyz/justsoft/video_thumbnail/VideoThumbnailPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/builder/.pub-cache/hosted/pub.dev/video_thumbnail-0.5.3/android/src/main/java/xyz/justsoft/video_thumbnail/VideoThumbnailPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart:372:22: Error: The getter 'WidgetStateProperty' isn't defined for the class '_ButtonsTabBarState'.
 - '_ButtonsTabBarState' is from 'package:buttons_tabbar/buttons_tabbar.dart' ('../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
          elevation: WidgetStateProperty.all(widget.elevation),
                     ^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart:373:24: Error: The getter 'WidgetStateProperty' isn't defined for the class '_ButtonsTabBarState'.
 - '_ButtonsTabBarState' is from 'package:buttons_tabbar/buttons_tabbar.dart' ('../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
          minimumSize: WidgetStateProperty.all(const Size(40, 40)),
                       ^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart:374:20: Error: The getter 'WidgetStateProperty' isn't defined for the class '_ButtonsTabBarState'.
 - '_ButtonsTabBarState' is from 'package:buttons_tabbar/buttons_tabbar.dart' ('../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
          padding: WidgetStateProperty.all(EdgeInsets.zero),
                   ^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart:375:22: Error: The getter 'WidgetStateProperty' isn't defined for the class '_ButtonsTabBarState'.
 - '_ButtonsTabBarState' is from 'package:buttons_tabbar/buttons_tabbar.dart' ('../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
          textStyle: WidgetStateProperty.all(textStyle),
                     ^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart:377:18: Error: The getter 'WidgetStateProperty' isn't defined for the class '_ButtonsTabBarState'.
 - '_ButtonsTabBarState' is from 'package:buttons_tabbar/buttons_tabbar.dart' ('../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
          shape: WidgetStateProperty.all(
                 ^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart:389:28: Error: The getter 'WidgetStateProperty' isn't defined for the class '_ButtonsTabBarState'.
 - '_ButtonsTabBarState' is from 'package:buttons_tabbar/buttons_tabbar.dart' ('../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
          backgroundColor: WidgetStateProperty.all(Colors.transparent),
                           ^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart:390:25: Error: The getter 'WidgetStateProperty' isn't defined for the class '_ButtonsTabBarState'.
 - '_ButtonsTabBarState' is from 'package:buttons_tabbar/buttons_tabbar.dart' ('../.pub-cache/hosted/pub.dev/buttons_tabbar-1.3.12/lib/buttons_tabbar.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
          overlayColor: WidgetStateProperty.all(widget.splashColor),
                        ^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script '/Users/builder/programs/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy' line: 1419

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDevelopmentRelease'.
> Process 'command '/Users/builder/programs/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 11s
Running Gradle task 'bundleDevelopmentRelease'...                 191.9s
Gradle task bundleDevelopmentRelease failed with exit code 1

Build failed :|
Failed to build for Android

Description

When i try to build from local and from codemagic i get the error showed above.

Steps to Reproduce

  1. Create a new project and install library
  2. Build project

Expected Behavior

App Build.

Actual Behavior

App Build error.

Additional Information

[Provide any additional information that may be helpful in understanding and reproducing the issue.]

Code Example

[Provide a minimal, complete, and verifiable example that reproduces the issue. Use code blocks to preserve the formatting.]

import 'package:buttons_tabbar/buttons_tabbar.dart';
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Example(),
    );
  }
}

class Example extends StatefulWidget {
  const Example({Key? key}) : super(key: key);

  @override
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: DefaultTabController(
          length: 3,
          child: Column(
            children: <Widget>[
              ButtonsTabBar(
                tabs: const [
                  Tab(
                    icon: Icon(Icons.directions_car),
                    text: "car",
                  ),
                  Tab(
                    icon: Icon(Icons.directions_transit),
                    text: "transit",
                  ),
                  Tab(icon: Icon(Icons.directions_bike)),
                ],
              ),
              const Expanded(
                child: TabBarView(
                  children: <Widget>[
                    Center(
                      child: Icon(Icons.directions_car),
                    ),
                    Center(
                      child: Icon(Icons.directions_transit),
                    ),
                    Center(
                      child: Icon(Icons.directions_bike),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Please make sure to include a working example code that can reproduce the bug. You can use the provided code snippet as a starting point.

Thank you for reporting this bug! We appreciate your contribution to improving our Flutter package.

afonsocraposo commented 3 months ago

Hey @fidelQabit! In Flutter 3.22.0, MaterialState was renamed to WidgetState. You should use Flutter SDK version 3.22.0 or use version 1.3.10 of this package.