fearture_request#18 : done

- Provide customer app support
master
NikhilVadoliya 3 years ago
parent 650953b04e
commit f239fb39bb

@ -4,10 +4,8 @@ import 'package:flutter_slider_drawer/src/helper/slider_app_bar.dart';
import 'package:flutter_slider_drawer/src/slider_direction.dart'; import 'package:flutter_slider_drawer/src/slider_direction.dart';
class SAppBar extends StatelessWidget { class SAppBar extends StatelessWidget {
final Widget? drawerIcon;
final Color splashColor; final Color splashColor;
final Color drawerIconColor;
final double drawerIconSize;
final AnimationController animationController; final AnimationController animationController;
final VoidCallback onTap; final VoidCallback onTap;
final SlideDirection slideDirection; final SlideDirection slideDirection;
@ -16,10 +14,7 @@ class SAppBar extends StatelessWidget {
const SAppBar( const SAppBar(
{Key? key, {Key? key,
this.drawerIcon,
this.splashColor = Colors.black, this.splashColor = Colors.black,
this.drawerIconColor = Colors.black87,
this.drawerIconSize = 27,
required this.animationController, required this.animationController,
required this.onTap, required this.onTap,
required this.slideDirection, required this.slideDirection,
@ -40,13 +35,13 @@ class SAppBar extends StatelessWidget {
List<Widget> appBar() { List<Widget> appBar() {
List<Widget> list = [ List<Widget> list = [
drawerIcon ?? sliderAppBar.drawerIcon ??
IconButton( IconButton(
splashColor: splashColor, splashColor: splashColor,
icon: AnimatedIcon( icon: AnimatedIcon(
icon: AnimatedIcons.menu_close, icon: AnimatedIcons.menu_close,
color: drawerIconColor, color: sliderAppBar.drawerIconColor,
size: drawerIconSize, size: sliderAppBar.drawerIconSize,
progress: animationController), progress: animationController),
onPressed: () => onTap()), onPressed: () => onTap()),
Expanded( Expanded(

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SliderAppBar { class SliderAppBar extends StatelessWidget {
/// [double] you can change appBar height by this parameter [appBarHeight] /// [double] you can change appBar height by this parameter [appBarHeight]
/// ///
final double appBarHeight; final double appBarHeight;
@ -40,7 +40,10 @@ class SliderAppBar {
const SliderAppBar({ const SliderAppBar({
this.appBarHeight = 70, this.appBarHeight = 70,
this.title = const Text('AppBar'), this.title = const Text(
'AppBar',
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
this.isTitleCenter = true, this.isTitleCenter = true,
this.appBarColor = Colors.white, this.appBarColor = Colors.white,
this.appBarPadding = const EdgeInsets.only(top: 24), this.appBarPadding = const EdgeInsets.only(top: 24),
@ -49,4 +52,9 @@ class SliderAppBar {
this.drawerIcon, this.drawerIcon,
this.drawerIconSize = 27, this.drawerIconSize = 27,
}); });
@override
Widget build(BuildContext context) {
return Offstage();
}
} }

@ -62,7 +62,7 @@ class SliderDrawer extends StatefulWidget {
///[appBar] if you set [null] then it will not display app bar ///[appBar] if you set [null] then it will not display app bar
/// ///
final SliderAppBar? appBar; final Widget? appBar;
/// The primary color of the button when the drawer button is in the down (pressed) state. /// The primary color of the button when the drawer button is in the down (pressed) state.
/// The splash is represented as a circular overlay that appears above the /// The splash is represented as a circular overlay that appears above the
@ -153,6 +153,10 @@ class SliderDrawerState extends State<SliderDrawer>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color appBarColor = Colors.white;
if (widget.appBar is SliderAppBar) {
appBarColor = (widget.appBar as SliderAppBar).appBarColor;
}
return LayoutBuilder(builder: (context, constrain) { return LayoutBuilder(builder: (context, constrain) {
return Container( return Container(
child: Stack(children: <Widget>[ child: Stack(children: <Widget>[
@ -193,20 +197,19 @@ class SliderDrawerState extends State<SliderDrawer>
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
color: widget.appBar?.appBarColor ?? Colors.transparent, color: appBarColor,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
if (widget.appBar != null) if (widget.appBar != null && widget.appBar is SliderAppBar)
SAppBar( SAppBar(
slideDirection: widget.slideDirection, slideDirection: widget.slideDirection,
onTap: () => toggle(), onTap: () => toggle(),
animationController: _animationDrawerController!, animationController: _animationDrawerController!,
drawerIcon: widget.appBar!.drawerIcon,
drawerIconColor: widget.appBar!.drawerIconColor,
drawerIconSize: widget.appBar!.drawerIconSize,
splashColor: widget.splashColor, splashColor: widget.splashColor,
sliderAppBar: widget.appBar!, sliderAppBar: widget.appBar as SliderAppBar,
), ),
if (widget.appBar != null && widget.appBar is! SliderAppBar)
widget.appBar!,
Expanded(child: widget.child), Expanded(child: widget.child),
], ],
), ),
@ -296,7 +299,6 @@ class SliderDrawerState extends State<SliderDrawer>
move(double percent) { move(double percent) {
_percent = percent; _percent = percent;
_animationDrawerController!.value = percent; _animationDrawerController!.value = percent;
//_animationDrawerController!.notifyListeners();
} }
openOrClose() { openOrClose() {

Loading…
Cancel
Save