From fa29a229fd3de6ae6ef612d1e08f25c0af3b0f09 Mon Sep 17 00:00:00 2001 From: Matej Zidek Date: Sun, 16 Oct 2022 16:42:45 +0200 Subject: [PATCH] fix #3 separated column list modify bug --- .gitignore | 2 + example/android/app/build.gradle | 4 +- .../android/app/src/main/AndroidManifest.xml | 1 + example/android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/lib/main.dart | 4 +- example/linux/flutter/generated_plugins.cmake | 8 +++ .../Flutter/GeneratedPluginRegistrant.swift | 2 - example/pubspec.lock | 51 ++++++++----------- .../windows/flutter/generated_plugins.cmake | 8 +++ lib/src/separated_flex.dart | 4 +- pubspec.lock | 51 ------------------- pubspec.yaml | 4 ++ test/flextras_test.dart | 37 ++++++++++++++ 14 files changed, 91 insertions(+), 91 deletions(-) delete mode 100644 pubspec.lock create mode 100644 test/flextras_test.dart diff --git a/.gitignore b/.gitignore index a247422..dd50d7a 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,5 @@ build/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 + +pubspec.lock diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 6ca2344..86d5ab4 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -36,7 +36,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 34dd77e..dc491d0 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" + android:exported="true" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> diff --git a/example/android/build.gradle b/example/android/build.gradle index 9b6ed06..39a8347 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.5.30' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index bc6a58a..595fb86 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-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip diff --git a/example/lib/main.dart b/example/lib/main.dart index e2aa693..6ba45cc 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -29,10 +29,10 @@ class MyApp extends StatelessWidget { ), Text("BOTTOM CONTENT", style: TextStyle(fontSize: 20)), ], - ), + ), )), ]), - ), + ), SeparatedRow(children: [ Expanded(child: Container(width: 200, height: 20, color: Colors.green)), Expanded(child: Container(width: 200, height: 20, color: Colors.green)), diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake index 51436ae..2e1de87 100644 --- a/example/linux/flutter/generated_plugins.cmake +++ b/example/linux/flutter/generated_plugins.cmake @@ -5,6 +5,9 @@ list(APPEND FLUTTER_PLUGIN_LIST ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index cf98146..cccf817 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -2,8 +2,6 @@ // Generated file. Do not edit. // -// clang-format off - import FlutterMacOS import Foundation diff --git a/example/pubspec.lock b/example/pubspec.lock index feaf529..4ce9cfe 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,28 +21,21 @@ 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" cupertino_icons: dependency: "direct main" description: @@ -56,14 +49,14 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flextras: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.0.1" + version: "0.1.0" flutter: dependency: "direct main" description: flutter @@ -80,21 +73,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 @@ -106,7 +106,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -127,35 +127,28 @@ 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" flutter: ">=1.17.0" diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake index 4d10c25..b93c4c3 100644 --- a/example/windows/flutter/generated_plugins.cmake +++ b/example/windows/flutter/generated_plugins.cmake @@ -5,6 +5,9 @@ list(APPEND FLUTTER_PLUGIN_LIST ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/lib/src/separated_flex.dart b/lib/src/separated_flex.dart index 1333727..068eb30 100644 --- a/lib/src/separated_flex.dart +++ b/lib/src/separated_flex.dart @@ -29,7 +29,7 @@ class SeparatedRow extends StatelessWidget { @override Widget build(BuildContext context) { - List c = children.toList(); + List c = [...children]; for (var i = c.length; i-- > 0;) { if (i > 0) c.insert(i, separatorBuilder()); } @@ -73,7 +73,7 @@ class SeparatedColumn extends StatelessWidget { @override Widget build(BuildContext context) { - List c = children.toList(); + List c = [...children]; for (var i = c.length; i-- > 0;) { if (i > 0) c.insert(i, separatorBuilder()); } diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index 10c9218..0000000 --- a/pubspec.lock +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" -sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=1.17.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1e47a5c..ce29799 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,4 +12,8 @@ dependencies: flutter: sdk: flutter +dev_dependencies: + flutter_test: + sdk: flutter + flutter: diff --git a/test/flextras_test.dart b/test/flextras_test.dart new file mode 100644 index 0000000..6a5bcf1 --- /dev/null +++ b/test/flextras_test.dart @@ -0,0 +1,37 @@ +import 'package:flextras/flextras.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +Widget app({ + required Widget child, +}) { + return MaterialApp( + home: Scaffold( + body: child, + ), + ); +} + +void main() { + final myList = ['hello', 'dog', 'launch']; + final separatedColumn = SeparatedColumn( + separatorBuilder: () => SizedBox(height: 12), + children: myList.map((e) => Text('$e\n')).toList(), + ); + final separatedColumn2 = SeparatedColumn( + separatorBuilder: () => SizedBox(height: 12), + children: [ + ...myList.map((e) => Text('$e\n')), + ], + ); + + testWidgets('builds SeparatedColumn without error', (tester) async { + await tester.pumpWidget(app(child: separatedColumn)); + expect(tester.takeException(), isNull); + + // Regression test for: https://github.com/gskinnerTeam/flutter-flextras/issues/3 + // This would throw an exception if regressed. + await tester.pumpWidget(app(child: separatedColumn2)); + expect(tester.takeException(), isNull); + }); +}