Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
- name: Analyze static code
run: dart analyze

- name: Run test(s)
run: flutter test

- name: Check publish warnings
run: dart pub publish --dry-run

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.0.0

- **BREAKING CHANGE**: Migrates from `package:flutter/material.dart` to the `material_ui` package (`package:material_ui/material_ui.dart`). `BaseflowPluginExample` now builds a `material_ui` `MaterialApp`, so example pages built with `material_ui` widgets (such as `TextField` and `DropdownMenu`) find their `MaterialLocalizations`. Public types such as the `MaterialColor` returned by `BaseflowPluginExample.createMaterialColor` now come from `material_ui`; examples should import `package:material_ui/material_ui.dart` instead of `package:flutter/material.dart`.
- Raises the minimum SDK to Dart 3.12.0 and Flutter 3.44.0.

## 2.2.1

- Fixes complile error on latest versions of Flutter.
Expand All @@ -22,7 +27,7 @@

## 2.0.0-nullsafety

- Migrates the templates to support sound null safety. Details are described in the [Announcing Dart null safety beta](https://medium.com/flutter/announcing-dart-null-safety-beta-4491da22077a) article.
- Migrates the templates to support sound null safety. Details are described in the [Dart null safety](https://dart.dev/null-safety) documentation.

## 1.0.0

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ Add the dependency in the yaml of the example:

```yaml
dependencies:
baseflow_plugin_template: ^2.2.0
baseflow_plugin_template: ^3.0.0
material_ui: ^1.0.0
```

Version 3.0.0 and up require Dart 3.12.0 and Flutter 3.44.0 or newer, and build on the
[material_ui](https://pub.dev/packages/material_ui) package. Import
`package:material_ui/material_ui.dart` in your example instead of
`package:flutter/material.dart`, so your pages and the template use the same Material library.

And run the template app:

```dart
Expand Down
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
analyzer:
exclude:
- build/**
include: package:flutter_lints/flutter.yaml
58 changes: 0 additions & 58 deletions example/android/app/build.gradle

This file was deleted.

49 changes: 49 additions & 0 deletions example/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
id("com.android.application")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}

android {
namespace = "com.example.example"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.example"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
// Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION
// is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions)
// You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true`
// flag during build.
versionCode = flutter.versionCode
versionName = flutter.versionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}

flutter {
source = "../.."
}
18 changes: 0 additions & 18 deletions example/android/build.gradle

This file was deleted.

24 changes: 24 additions & 0 deletions example/android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
allprojects {
repositories {
google()
mavenCentral()
}
}

val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}

tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
7 changes: 5 additions & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
# This newDsl flag was added by the Flutter template
android.newDsl=false
# This builtInKotlin flag was added by the Flutter template
android.builtInKotlin=false
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 @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.2-all.zip
25 changes: 0 additions & 25 deletions example/android/settings.gradle

This file was deleted.

26 changes: 26 additions & 0 deletions example/android/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "9.3.1" apply false
id("org.jetbrains.kotlin.android") version "2.4.20" apply false
}

include(":app")
20 changes: 10 additions & 10 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import 'package:baseflow_plugin_template/baseflow_plugin_template.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';

void main() {
runApp(BaseflowPluginExample(
pluginName: 'test plugin',
githubURL: 'https://github.com/baseflow/baseflow_plugin_template',
pubDevURL: 'https://pub.dev/publishers/baseflow.com/packages',
pages: [CenteredText.createPage()],
));
runApp(
BaseflowPluginExample(
pluginName: 'test plugin',
githubURL: 'https://github.com/baseflow/baseflow_plugin_template',
pubDevURL: 'https://pub.dev/publishers/baseflow.com/packages',
pages: [CenteredText.createPage()],
),
);
}

class CenteredText extends StatelessWidget {
Expand All @@ -19,8 +21,6 @@ class CenteredText extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const Center(
child: Text('Very simple example'),
);
return const Center(child: Text('Very simple example'));
}
}
5 changes: 3 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0

environment:
sdk: ^3.0.0
flutter: ">=3.19.0"
sdk: ^3.12.0
flutter: ">=3.44.0"

dependencies:
flutter:
sdk: flutter
material_ui: ^1.0.0
baseflow_plugin_template:
path: ../

Expand Down
30 changes: 10 additions & 20 deletions lib/src/app.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:baseflow_plugin_template/src/info_page.dart';
import 'package:baseflow_plugin_template/src/page.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (optional): an example that bumps to 3.0.0 but still builds its pages with package:flutter/material.dart widgets (TextField, DropdownMenu) compiles, then throws "No MaterialLocalizations found" when the page builds. BaseflowPluginExample.build now returns material_ui's MaterialApp, which registers only material_ui's localizations, and nothing bridges flutter widgets under a material_ui app. flutter analyze only shows deprecation infos, so the break shows up at runtime.

Fix: also pass flutter's DefaultMaterialLocalizations.delegate in localizationsDelegates so unmigrated examples keep working, or keep the break and make sure each plugin example changes its imports in the same PR as the bump.


import 'home.dart';

Expand All @@ -11,8 +11,9 @@ class BaseflowPluginExample extends StatelessWidget {
final List<Widget>? appBarActions;

/// [MaterialColor] to be used in the app [ThemeData]
final MaterialColor themeMaterialColor =
createMaterialColor(const Color.fromRGBO(48, 49, 60, 1));
final MaterialColor themeMaterialColor = createMaterialColor(
const Color.fromRGBO(48, 49, 60, 1),
);

BaseflowPluginExample({
super.key,
Expand All @@ -31,9 +32,9 @@ class BaseflowPluginExample extends StatelessWidget {
title: 'Baseflow $pluginName',
theme: ThemeData(
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: Colors.white60,
surface: const Color.fromRGBO(48, 49, 60, 0.8),
),
secondary: Colors.white60,
surface: const Color.fromRGBO(48, 49, 60, 0.8),
),
buttonTheme: ButtonThemeData(
buttonColor: themeMaterialColor.shade500,
disabledColor: themeMaterialColor.withRed(200),
Expand All @@ -46,21 +47,10 @@ class BaseflowPluginExample extends StatelessWidget {
hintColor: themeMaterialColor.shade500,
primarySwatch: createMaterialColor(const Color.fromRGBO(48, 49, 60, 1)),
textTheme: const TextTheme(
bodyLarge: TextStyle(
color: Colors.white,
fontSize: 16,
height: 1.3,
),
bodyMedium: TextStyle(
color: Colors.white,
fontSize: 18,
height: 1.2,
),
bodyLarge: TextStyle(color: Colors.white, fontSize: 16, height: 1.3),
bodyMedium: TextStyle(color: Colors.white, fontSize: 18, height: 1.2),
labelLarge: TextStyle(color: Colors.white),
displayLarge: TextStyle(
color: Colors.white,
fontSize: 18,
),
displayLarge: TextStyle(color: Colors.white, fontSize: 18),
),
visualDensity: VisualDensity.adaptivePlatformDensity,
inputDecorationTheme: const InputDecorationTheme(
Expand Down
Loading
Loading