Skip to content

Commit

Permalink
Creating Mobile Sidebar plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rodydavis committed May 9, 2019
1 parent 36382c0 commit 084c17b
Show file tree
Hide file tree
Showing 112 changed files with 4,711 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/mobile_sidebar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
.dart_tool/

.packages
.pub/

build/
29 changes: 29 additions & 0 deletions packages/mobile_sidebar/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions packages/mobile_sidebar/.idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions packages/mobile_sidebar/.idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions packages/mobile_sidebar/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/mobile_sidebar/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

151 changes: 151 additions & 0 deletions packages/mobile_sidebar/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions packages/mobile_sidebar/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 45d2b15d97e1dd6f3a04a9139678c9631aaff6ba
channel: master

project_type: plugin
3 changes: 3 additions & 0 deletions packages/mobile_sidebar/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

* Creating new widget
1 change: 1 addition & 0 deletions packages/mobile_sidebar/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
117 changes: 117 additions & 0 deletions packages/mobile_sidebar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# mobile_sidebar

A Flutter plugin to show a sidebar on tablet and desktop then a list or gridview on mobile.


## Example

``` dart
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:mobile_sidebar/mobile_sidebar.dart';
void main() {
_setTargetPlatformForDesktop();
runApp(MyApp());
}
/// If the current platform is desktop, override the default platform to
/// a supported platform (iOS for macOS, Android for Linux and Windows).
/// Otherwise, do nothing.
void _setTargetPlatformForDesktop() {
TargetPlatform targetPlatform;
if (Platform.isMacOS) {
targetPlatform = TargetPlatform.iOS;
} else if (Platform.isLinux || Platform.isWindows) {
targetPlatform = TargetPlatform.android;
}
if (targetPlatform != null) {
debugDefaultTargetPlatformOverride = targetPlatform;
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: new HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
bool _showList = false;
final _breakpoint = 800.0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Mobile Side Menu Example'),
actions: <Widget>[
if (MediaQuery.of(context).size.width < _breakpoint) ...[
IconButton(
icon: Icon(_showList ? Icons.grid_on : Icons.grid_off),
onPressed: () {
if (mounted)
setState(() {
_showList = !_showList;
});
},
)
]
],
),
body: MobileSidebar(
items: <MenuItem>[
MenuItem(
icon: Icons.edit,
color: Colors.black,
title: 'Manage',
subtitle: 'Edit, Share, Delete',
child: Container(color: Colors.blueAccent),
),
MenuItem(
icon: Icons.event,
color: Colors.blueAccent,
title: 'Tasks',
subtitle: 'Personal Tasks',
child: Container(color: Colors.purpleAccent),
),
MenuItem(
icon: Icons.timer,
color: Colors.blueGrey,
title: 'Log',
subtitle: 'History of Results',
child: Container(color: Colors.black),
),
MenuItem(
icon: Icons.star,
color: Colors.amber,
title: 'Favorites',
subtitle: 'Custom List',
child: Container(color: Colors.yellowAccent),
),
],
showList: _showList,
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton.extended(
backgroundColor: Colors.redAccent,
heroTag: 'create-contact',
label: Text('Add new item'),
icon: Icon(Icons.add),
onPressed: () {},
),
),
);
}
}
```
Loading

0 comments on commit 084c17b

Please sign in to comment.