Update README.md

Add default usage
This commit is contained in:
David Peters 2020-07-30 21:38:41 +02:00 committed by GitHub
parent 6e22b4d2fc
commit f62b922ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 45 additions and 1 deletions

View File

@ -2,7 +2,7 @@
A lightweight flutter package providing a miniplayer widget which resizes according to drag gestures and returns a builder function with the current height and percentage progress.
## Usuage
## Usage
```dart
Miniplayer(
@ -15,3 +15,47 @@ Miniplayer(
},
),
```
#### Default usage
```
import 'package:flutter/material.dart';
import 'package:miniplayer/miniplayer.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Miniplayer Demo',
theme: ThemeData(
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
builder: (context, child) { // <--- Important part
return Stack(
children: [
child,
Miniplayer(
minHeight: 70,
maxHeight: 370,
builder: (height, percentage) {
if(percentage > 0.2)
//return Text('!mini');
else
//return Text('mini');
},
),
],
);
},
);
}
}
```
#### Usage with BottomNavigationBar
```
Example coming soon!
```