Skip to content

Commit

Permalink
[perf]:[Fix the display issue of the tabbar in Flutter 3.22.] Lianjia…
Browse files Browse the repository at this point in the history
  • Loading branch information
violinday committed May 20, 2024
1 parent 07d7c5e commit 2e879e3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
11 changes: 7 additions & 4 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@

plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -21,10 +28,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion

Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
35 changes: 27 additions & 8 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
}
}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
}


include ':app'
3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ dependencies:
flutter_easyrefresh: ^2.2.1
lpinyin: ^2.0.3
badges: ^2.0.2
intl: ^0.18.0
intl: 0.19.0

dev_dependencies:
flutter_test:
sdk: flutter
dependency_overrides:
bruno:
path: ../
intl: 0.19.0


# For information on the generic Dart part of this file, see the
Expand Down
5 changes: 4 additions & 1 deletion lib/src/components/tabbar/normal/brn_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class BrnTabBarState extends State<BrnTabBar> {
widget.tabWidth != null ||
widget.isScroll;
return TabBar(
tabAlignment: _isScrollable ? TabAlignment.start : TabAlignment.fill,
tabs: fillWidgetByDataList(_isScrollable),
controller: widget.controller,
isScrollable: _isScrollable,
Expand All @@ -273,6 +274,8 @@ class BrnTabBarState extends State<BrnTabBar> {
unselectedLabelStyle: widget.unselectedLabelStyle ??
widget.themeData!.unselectedLabelStyle.generateTextStyle(),
dragStartBehavior: widget.dragStartBehavior,
dividerColor: Colors.transparent,
dividerHeight: 0,
onTap: (index) {
if (widget.onTap != null) {
widget.onTap!(this, index);
Expand Down Expand Up @@ -409,7 +412,7 @@ class BrnTabBarState extends State<BrnTabBar> {
),
backgroundColor: Colors.red,
alignment: Alignment.topLeft,
offset:Offset(_dx,_dy) ,
offset: Offset(_dx,_dy),
padding: _badgePadding,
largeSize: _largeSize,
child: Text(
Expand Down

0 comments on commit 2e879e3

Please sign in to comment.