Skip to content

Commit

Permalink
fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
rodydavis committed Mar 28, 2020
1 parent fd9a4f1 commit 7192513
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 28 deletions.
27 changes: 16 additions & 11 deletions CHANGELOG.md
@@ -1,20 +1,25 @@
## [1.0.4]
## 1.5.0

* Fixed isDense Tap Target
- Renamed to [NavRail] because Flutter released [NavigationRail] on the master channel
- https://github.com/flutter/flutter/pull/49574

## [1.0.3]
## 1.0.4

* Bidirectional for i18n
* Fixes: https://github.com/rodydavis/navigation_rail/issues/2
- Fixed isDense Tap Target

## [1.0.2]
## 1.0.3

* Fix Tablet Colors
- Bidirectional for i18n
- Fixes: https://github.com/rodydavis/navigation_rail/issues/2

## [1.0.1]
## 1.0.2

* Fix Tablet Icon
- Fix Tablet Colors

## [1.0.0]
## 1.0.1

* First Version
- Fix Tablet Icon

## 1.0.0

- First Version
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -53,7 +53,7 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return NavigationRail(
return NavRail(
drawerHeaderBuilder: (context) {
return Column(
children: <Widget>[
Expand Down
124 changes: 115 additions & 9 deletions example/README.md
@@ -1,16 +1,122 @@
# example

A new Flutter project.
```dart
import 'package:flutter/material.dart';
import 'package:navigation_rail/navigation_rail.dart';
## Getting Started
void main() => runApp(MyApp());
This project is a starting point for a Flutter application.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'NavigationRail Demo',
theme: _theme(ThemeData.light().copyWith(
accentColor: Colors.red,
)),
darkTheme: ThemeData.dark(),
home: Directionality(
textDirection: TextDirection.ltr,
child: MyHomePage(title: 'Navigation Rail Demo'),
),
);
}
A few resources to get you started if this is your first Flutter project:
ThemeData _theme(ThemeData base) {
return ThemeData(
primarySwatch: Colors.blue,
appBarTheme: base.appBarTheme.copyWith(elevation: 0.0),
floatingActionButtonTheme: base.floatingActionButtonTheme.copyWith(
elevation: 2.0,
backgroundColor: base.accentColor,
),
);
}
}
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _currentIndex = 0;
@override
Widget build(BuildContext context) {
return NavRail(
isDense: false,
drawerHeaderBuilder: (context) {
return Column(
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text("Steve Jobs"),
accountEmail: Text("jobs@apple.com"),
),
],
);
},
drawerFooterBuilder: (context) {
return Column(
children: <Widget>[
ListTile(
leading: Icon(Icons.settings),
title: Text("Settings"),
),
ListTile(
leading: Icon(Icons.info_outline),
title: Text("About"),
),
],
);
},
currentIndex: _currentIndex,
onTap: (val) {
if (mounted)
setState(() {
_currentIndex = val;
});
},
title: Text(widget.title),
body: IndexedStack(
index: _currentIndex,
children: <Widget>[
Container(color: Colors.blue[300]),
Container(color: Colors.red[300]),
Container(color: Colors.purple[300]),
Container(color: Colors.grey[300]),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
tooltip: 'Increment',
child: Icon(Icons.add),
),
tabs: <BottomNavigationBarItem>[
BottomNavigationBarItem(
title: Text("Folders"),
icon: Icon(Icons.folder),
),
BottomNavigationBarItem(
title: Text("History"),
icon: Icon(Icons.history),
),
BottomNavigationBarItem(
title: Text("Gallery"),
icon: Icon(Icons.photo_library),
),
BottomNavigationBarItem(
title: Text("Camera"),
icon: Icon(Icons.camera),
),
],
);
}
}
```
2 changes: 1 addition & 1 deletion example/lib/main.dart
Expand Up @@ -46,7 +46,7 @@ class _MyHomePageState extends State<MyHomePage> {

@override
Widget build(BuildContext context) {
return NavigationRail(
return NavRail(
isDense: false,
drawerHeaderBuilder: (context) {
return Column(
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Expand Up @@ -101,7 +101,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.4+2"
version: "1.5.0"
path:
dependency: transitive
description:
Expand Down
5 changes: 2 additions & 3 deletions lib/navigation_rail.dart
Expand Up @@ -4,12 +4,11 @@ const _tabletBreakpoint = 720.0;
const _desktopBreakpoint = 1440.0;
const _minHeight = 400.0;
const _tabletSpacingVertical = 8.0;
const _tabletSpacingHorizontal = 10.0;
const _drawerWidth = 304.0;
const _railSize = 72.0;
const _denseRailSize = 56.0;

class NavigationRail extends StatelessWidget {
class NavRail extends StatelessWidget {
final FloatingActionButton floatingActionButton;
final int currentIndex;
final Widget body;
Expand All @@ -27,7 +26,7 @@ class NavigationRail extends StatelessWidget {
final bool hideTitleBar;
final GlobalKey<ScaffoldState> scaffoldKey;

const NavigationRail({
const NavRail({
Key key,
@required this.currentIndex,
@required this.tabs,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
@@ -1,8 +1,8 @@
name: navigation_rail
description: A Navigation Rail for Flutter
version: 1.0.4+2
version: 1.5.0
author: Rody Davis <rody.davis.jr@gmail.com>
maintainer: Rody Davis (@AppleEducate)
maintainer: Rody Davis (@rodydavis)
homepage: https://github.com/rodydavis/navigation_rail

environment:
Expand Down

0 comments on commit 7192513

Please sign in to comment.