If this project helped you reduce developement time or you just want to help me continue making useful tools
A Very Flexible Widget that can Implement Material Sheets (bottom, top, side) (modal and persistent)
MULTIPLE SHEETS PER APP
WIDGET PARAMETERS
- app [required] -> the application that goes behind the sheet
- sheet [required] -> the sheet that animates in or out of the screen
- attachment -> an attachment to the sheet that is always on screen
VARIABLE PARAMETERS
- startOpen -> whether or not the sheet should startOpen (true, false)
- position -> what edge the sheet is attached to (top, right, bottom, left)
- type -> what type of sheet this is (modal, persistent)
- placement -> where the attachment is placed relative to the screen edges (inside, outside)
- backBtnClosesSheet -> whether or not the back button closes the sheet
- backBtnClosesAnimated -> whether the back button closes the sheet animated or instantaneously
- autoOpenOrCloseIndicator -> whether or not you should be shown whether you sheet will autoClose or autoOpen after you let go of it
- swipeToOpen -> whether or not you can swipe the sheet to open (NOTE: if no attachment is specified you will swipe the edge of the screen to open)
- swipeToClose -> whether or not you can swipe the sheet to close
- maxAnimationTimeInMilliseconds -> how long the sheet takes to open or close if animated
- indicatorAutoCloseColor -> the color that shows up when the sheet will auto close if let go [opacity matter]
- scrimOpenColor -> the color of the scrim when using a modal sheet [opacity matters]
- sheetMin -> the smallest the sheet can be
- sheetMax -> the largest the sheet can be
- textDirection -> the text direction inside of the sheet
FUNCTIONS TO GRAB INFORMATION
- getOpenPercent() -> get how open the sheet is [0.0 -> 1.0]
- getAttachmentSize() -> get the width and height of the attachment
- getSheetSize() -> get the width and height of the sheet
FUNCTIONS TO RUN COMMANDS
- toggleInstantaneous() -> toggle between opened and closed states with no animation
- toggleAnimated() -> toggle between opened and closed states with animation
- openInstantaneous() -> open the sheet instantly
- openAnimated() -> open the sheet with an animation
- closeInstantaneous() -> close the sheet instantly
- closeAnimated() -> close the sheet with an animation
import 'package:flutter/material.dart';
import 'materialSheet.dart';
void main() => runApp(new MaterialSheetTestApp());
class MaterialSheetTestApp extends StatelessWidget {
//NOTE: these are required if you want buttons that will be opening or closing the sheet
Sheet matSheet;
getOpenPercent() => matSheet.functions.getOpenPercent();
getSheetSize() => matSheet.functions.getSheetSize();
getAttachmentSize() => matSheet.functions.getAttachmentSize();
toggleInstant() => matSheet.functions.toggleInstantaneous();
toggleAnim() => matSheet.functions.toggleAnimated();
openInstant() => matSheet.functions.openInstantaneous();
closeInstant() => matSheet.functions.closeInstantaneous();
openAnim() => matSheet.functions.openAnimated();
closeAnim() => matSheet.functions.closeAnimated();
@override
Widget build(BuildContext context) {
matSheet = new Sheet(
parameters: new Parameters(
//-----Widgets
app: new Container(
child: new Center(
child: new FlatButton(
color: Colors.redAccent,
onPressed: () => openAnim(),
child: new Text("Press me to open the sheet"),
),
),
),
sheet: new Container(
color: Colors.yellowAccent,
child: new Center(
child: new Text(
"Right Sheet",
style: TextStyle(
color: Colors.black,
fontSize: 14.0,
),
),
),
),
attachment: new Container(
color: Colors.greenAccent,
child: new Icon(
Icons.attachment,
color: Colors.white,
),
),
//-----Other Vars
position: sheetPosition.right,
autoOpenOrCloseIndicator: true,
placement: attachmentPlacement.inside,
),
);
return matSheet;
}
}
- lockSheet (opened, closed, false) [mutable]
- sheetAffectsApp (resize, move, none) [mutable]