Skip to content

Commit

Permalink
Setting to v 0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
aqwert committed Feb 6, 2019
1 parent f088806 commit 3045c74
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 43 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [0.9.5] - Feb 07, 2019

#### (Flutter version support: v1.1.8)

- Updated all widgets compatible with Flutter v 1.1.8
- Added CupertnoThemeData to PlatformApp to style iOS apps.
- If using PlatformScaffold on each page, no need to define Material widget when using Material widgets on the page

## [0.9.0] - Jan 30, 2019

#### (Flutter version support: v1.0.0)
Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,21 @@ return PlatformAppBar(
);
```

> In iOS if a soliod color header is required and there is a ListView
> on the page, you would need to add some alpha to the color so that the
> ListView is not pushed down too far
```
appBar: PlatformAppBar(
title: Text('iOS Colored Header'),
ios: (_) => CupertinoNavigationBarData(
// Issue with cupertino where a bar with no transparency
// will push the list down. Adding some alpha value fixes it (in a hacky way)
backgroundColor: Colors.lightGreen.withAlpha(254),
),
),
```

#### Enhance

Extend with `WidgetBuilder` for android or iOS.
Expand Down Expand Up @@ -416,17 +431,6 @@ return PlatformNavBar(

- Setting `BottomNavigationBar.fixedColor` to anything has no effect.

- If using the Cupertino widgets it may complain that there is no Material parent when using material widgets further doen the widget tree and using MaterialApp. If this is the case you need to place `Material` as a parent widget to the PlatformWidget

```dart
return PlatformScaffold(
body: Material(
color: Colors.white,
child: _theBodyOfThePageWithMaterialWidgets(),
);
);
```

# Issues and Feedback

Please [create](https://github.com/aqwert/flutter_platform_widgets/issues/new) an issue to provide feedback or an issue.
Expand Down
19 changes: 10 additions & 9 deletions example/example.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter/cupertino.dart' show CupertinoIcons;
import 'package:flutter/cupertino.dart' show CupertinoIcons, CupertinoThemeData;
import 'package:flutter/material.dart' show ThemeData, Colors, Icons, Theme;
import 'package:flutter/widgets.dart';
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
Expand Down Expand Up @@ -27,13 +27,15 @@ class _AppState extends State<App> {
primarySwatch: Colors.purple,
);

return Theme(
data: themeData,
child: PlatformApp(
title: 'Flutter Platform Widgets',
android: (_) => new MaterialAppData(theme: themeData),
home: LandingPage(() => _switchPlatform()),
),
final cupertinoTheme = new CupertinoThemeData(
primaryColor: Colors.purple,
);

return PlatformApp(
title: 'Flutter Platform Widgets',
android: (_) => new MaterialAppData(theme: themeData),
ios: (_) => new CupertinoAppData(theme: cupertinoTheme),
home: LandingPage(() => _switchPlatform()),
);
}

Expand Down Expand Up @@ -67,7 +69,6 @@ class LandingPageState extends State<LandingPage> {
@override
Widget build(BuildContext context) {
return PlatformScaffold(
key: Key('AAA'),
iosContentPadding: true,
appBar: PlatformAppBar(
title: Text('Flutter Platform Widgets'),
Expand Down
18 changes: 7 additions & 11 deletions example/lib/listViewHeaderPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,19 @@ class ListViewHeaderPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return PlatformScaffold(
key: Key('111'),

/// This should not be seen, but a defect pushes down content
backgroundColor: Colors.yellow,
appBar: PlatformAppBar(
title: Text('iOS Colored Header'),
ios: (_) =>
CupertinoNavigationBarData(backgroundColor: Colors.lightGreen),
ios: (_) => CupertinoNavigationBarData(
// Issue with cupertino where a bar with no transparency
// will push the list down. Adding some alpha value fixes it (in a hacky way)
backgroundColor: Colors.lightGreen.withAlpha(254),
),
),
body: ListView(
children: _words
.map(
(w) => Material(
// required since ListTile is from Material library
child: ListTile(
title: Text(w),
),
(w) => ListTile(
title: Text(w),
),
)
.toList(),
Expand Down
8 changes: 2 additions & 6 deletions example/lib/listViewPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,14 @@ class ListViewPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return PlatformScaffold(
key: Key('222'),
appBar: PlatformAppBar(
title: Text('Page List View'),
),
body: ListView(
children: _words
.map(
(w) => Material(
// required since ListTile is from Material library
child: ListTile(
title: Text(w),
),
(w) => ListTile(
title: Text(w),
),
)
.toList(),
Expand Down
1 change: 0 additions & 1 deletion example/lib/tabbedPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class TabbedPageState extends State<TabbedPage> {
@override
Widget build(BuildContext context) {
return PlatformScaffold(
key: Key('333'),
iosContentPadding: true,
iosContentBottomPadding: true,
appBar: PlatformAppBar(
Expand Down
23 changes: 19 additions & 4 deletions lib/src/platform_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import 'package:flutter/cupertino.dart'
show
CupertinoPageScaffold,
CupertinoColors,
CupertinoTabScaffold,
ObstructingPreferredSizeWidget,
CupertinoTabBar;
import 'package:flutter/material.dart'
show Scaffold, FloatingActionButtonAnimator, FloatingActionButtonLocation;
show
Material,
Scaffold,
FloatingActionButtonAnimator,
FloatingActionButtonLocation;
import 'package:flutter/widgets.dart';

import 'platform_app_bar.dart';
Expand Down Expand Up @@ -142,11 +145,12 @@ class PlatformScaffold extends PlatformWidgetBase<Widget, Scaffold> {
Widget child = body ?? data?.body;
var navigationBar = appBar?.createIosWidget(context) ?? data?.navigationBar;

Widget result;
if (bottomNavBar != null) {
var tabBar = data?.bottomTabBar ?? bottomNavBar?.createIosWidget(context);

//https://docs.flutter.io/flutter/cupertino/CupertinoTabScaffold-class.html
return CupertinoTabScaffold(
result = CupertinoTabScaffold(
key: data?.widgetKey ?? widgetKey,
backgroundColor: data?.backgroundColorTab,
resizeToAvoidBottomInset: data?.resizeToAvoidBottomInsetTab ?? true,
Expand All @@ -161,14 +165,25 @@ class PlatformScaffold extends PlatformWidgetBase<Widget, Scaffold> {
},
);
} else {
return CupertinoPageScaffold(
result = CupertinoPageScaffold(
key: data?.widgetKey ?? widgetKey,
backgroundColor: data?.backgroundColor ?? backgroundColor,
child: iosContentPad(context, child, navigationBar, null),
navigationBar: navigationBar,
resizeToAvoidBottomInset: data?.resizeToAvoidBottomInset ?? true,
);
}

// Ensure that there is Material widget at the root page level
// as there will still be Material widgets using on ios (for now)
final materialWidget = context.ancestorWidgetOfExactType(Material);
if (materialWidget == null) {
return Material(
elevation: 0.0,
child: result,
);
}
return result;
}

Widget iosContentPad(BuildContext context, Widget child,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_platform_widgets
description: Simplifying the use of both Material and Cupertino widgets with a single widget
version: 0.9.0
version: 0.9.5
author: Lance Johnstone <[email protected]>
homepage: https://github.com/aqwert/flutter_platform_widgets

Expand Down

0 comments on commit 3045c74

Please sign in to comment.