Skip to content

Commit 0695ef4

Browse files
authored
Merge pull request #2 from Baseflow/add_appbar_actions
Appbar actions added as an optional parameter
2 parents d834673 + 7745cc7 commit 0695ef4

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.0
2+
3+
* Added the possibility to add actions to the appbar.
4+
15
## 2.0.0-nullsafety
26

37
* Migrated 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.

lib/src/app.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'home.dart';
88
class BaseflowPluginExample extends StatelessWidget {
99
final String pluginName;
1010
final List<ExamplePage> pages;
11+
final List<Widget>? appBarActions;
1112

1213
/// [MaterialColor] to be used in the app [ThemeData]
1314
final MaterialColor themeMaterialColor =
@@ -19,6 +20,7 @@ class BaseflowPluginExample extends StatelessWidget {
1920
required String githubURL,
2021
required String pubDevURL,
2122
required this.pages,
23+
this.appBarActions,
2224
}) : super(key: key) {
2325
pages.add(InfoPage.createPage(pluginName, githubURL, pubDevURL));
2426
}
@@ -65,6 +67,7 @@ class BaseflowPluginExample extends StatelessWidget {
6567
home: AppHome(
6668
title: 'Baseflow $pluginName example app',
6769
pages: pages,
70+
appBarActions: appBarActions,
6871
),
6972
);
7073
}

lib/src/home.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ class AppHome extends StatefulWidget {
88
Key? key,
99
required this.title,
1010
required this.pages,
11+
this.appBarActions,
1112
}) : super(key: key);
1213

1314
/// The [title] of the application, which is shown in the application's
1415
/// title bar.
1516
final String title;
1617
final List<ExamplePage> pages;
18+
final List<Widget>? appBarActions;
1719

1820
@override
1921
_AppHomeState createState() => _AppHomeState();
@@ -32,6 +34,7 @@ class _AppHomeState extends State<AppHome> {
3234
return Scaffold(
3335
appBar: AppBar(
3436
backgroundColor: Theme.of(context).bottomAppBarColor,
37+
actions: _currentPage == 0 ? widget.appBarActions : null,
3538
title: Center(
3639
child: Image.asset('logo.png',
3740
width: 140, package: 'baseflow_plugin_template'),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: baseflow_plugin_template
22
description: A template for plugin examples
3-
version: 2.0.0-nullsafety
3+
version: 2.1.0
44
author:
55
homepage:
66

0 commit comments

Comments
 (0)