Code Refactor

- Gesture error fixed :  Right-to-Left
master
NikhilVadoliya 2 years ago
parent 65efb5dfc8
commit fc3278cf2c

@ -1,3 +1,8 @@
## [2.1.2] - Release
* replace `sliderShadow` to `sliderBoxShadow`
* Slider RightToLeft : Gesture area issue fixed
* Fixed issue : #21 and #23
## [2.1.1] - Release ## [2.1.1] - Release
* Provide custom appBar feature * Provide custom appBar feature
* Slider LeftToRight and RightToLeft issue fixed * Slider LeftToRight and RightToLeft issue fixed

@ -3,7 +3,7 @@ import 'dart:ui';
class Colours { class Colours {
Colours._(); Colours._();
static Color blue() => const Color(0xff5e6ceb); static Color blue = const Color(0xff5e6ceb);
static Color blueDark() => const Color(0xff4D5DFB); static Color blueDark = const Color(0xff4D5DFB);
} }

@ -2,16 +2,19 @@ import 'package:flutter/material.dart';
import 'package:flutter_slider_drawer/flutter_slider_drawer.dart'; import 'package:flutter_slider_drawer/flutter_slider_drawer.dart';
void main() { void main() {
runApp(MyApp()); runApp(const MyApp());
} }
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override @override
_MyAppState createState() => _MyAppState(); MyAppState createState() => MyAppState();
} }
class _MyAppState extends State<MyApp> { class MyAppState extends State<MyApp> {
GlobalKey<SliderDrawerState> _key = GlobalKey<SliderDrawerState>(); final GlobalKey<SliderDrawerState> _sliderDrawerKey =
GlobalKey<SliderDrawerState>();
late String title; late String title;
@override @override
@ -23,6 +26,7 @@ class _MyAppState extends State<MyApp> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
theme: ThemeData(fontFamily: 'BalsamiqSans'),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
home: Scaffold( home: Scaffold(
body: SliderDrawer( body: SliderDrawer(
@ -31,11 +35,11 @@ class _MyAppState extends State<MyApp> {
title: Text(title, title: Text(title,
style: const TextStyle( style: const TextStyle(
fontSize: 22, fontWeight: FontWeight.w700))), fontSize: 22, fontWeight: FontWeight.w700))),
key: _key, key: _sliderDrawerKey,
sliderOpenSize: 179, sliderOpenSize: 179,
slider: _SliderView( slider: _SliderView(
onItemClick: (title) { onItemClick: (title) {
_key.currentState!.closeSlider(); _sliderDrawerKey.currentState!.closeSlider();
setState(() { setState(() {
this.title = title; this.title = title;
}); });
@ -57,10 +61,9 @@ class _SliderView extends StatelessWidget {
return Container( return Container(
color: Colors.white, color: Colors.white,
padding: const EdgeInsets.only(top: 30), padding: const EdgeInsets.only(top: 30),
child: Column( child: ListView(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox( const SizedBox(
height: 30, height: 30,
), ),
CircleAvatar( CircleAvatar(
@ -68,41 +71,39 @@ class _SliderView extends StatelessWidget {
backgroundColor: Colors.grey, backgroundColor: Colors.grey,
child: CircleAvatar( child: CircleAvatar(
radius: 60, radius: 60,
backgroundImage: AssetImage('assets/images/user_profile.jpg'), backgroundImage: Image.network(
'https://nikhilvadoliya.github.io/assets/images/nikhil_1.webp')
.image,
), ),
), ),
SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Text( const Text(
'Nick', 'Nick',
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 30, fontSize: 30,
fontFamily: 'BalsamiqSans'), ),
), ),
SizedBox( const SizedBox(
height: 20, height: 20,
), ),
_SliderMenuItem( ...[
title: 'Home', iconData: Icons.home, onTap: onItemClick), Menu(Icons.home, 'Home'),
_SliderMenuItem( Menu(Icons.add_circle, 'Add Post'),
title: 'Add Post', Menu(Icons.notifications_active, 'Notification'),
iconData: Icons.add_circle, Menu(Icons.favorite, 'Likes'),
onTap: onItemClick), Menu(Icons.settings, 'Setting'),
_SliderMenuItem( Menu(Icons.arrow_back_ios, 'LogOut')
title: 'Notification', ]
iconData: Icons.notifications_active, .map((menu) => _SliderMenuItem(
onTap: onItemClick), title: menu.title,
_SliderMenuItem( iconData: menu.iconData,
title: 'Likes', iconData: Icons.favorite, onTap: onItemClick), onTap: onItemClick))
_SliderMenuItem( .toList(),
title: 'Setting', iconData: Icons.settings, onTap: onItemClick),
_SliderMenuItem(
title: 'LogOut',
iconData: Icons.arrow_back_ios,
onTap: onItemClick),
], ],
), ),
); );
@ -125,7 +126,7 @@ class _SliderMenuItem extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListTile( return ListTile(
title: Text(title, title: Text(title,
style: TextStyle( style: const TextStyle(
color: Colors.black, fontFamily: 'BalsamiqSans_Regular')), color: Colors.black, fontFamily: 'BalsamiqSans_Regular')),
leading: Icon(iconData, color: Colors.black), leading: Icon(iconData, color: Colors.black),
onTap: () => onTap?.call(title)); onTap: () => onTap?.call(title));
@ -135,32 +136,33 @@ class _SliderMenuItem extends StatelessWidget {
class _AuthorList extends StatelessWidget { class _AuthorList extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Data> dataList = []; List<Quotes> quotesList = [];
dataList.add(Data(Colors.amber, 'Amelia Brown', quotesList.add(Quotes(Colors.amber, 'Amelia Brown',
'Life would be a great deal easier if dead things had the decency to remain dead.')); 'Life would be a great deal easier if dead things had the decency to remain dead.'));
dataList.add(Data(Colors.orange, 'Olivia Smith', quotesList.add(Quotes(Colors.orange, 'Olivia Smith',
'That proves you are unusual," returned the Scarecrow')); 'That proves you are unusual," returned the Scarecrow'));
dataList.add(Data(Colors.deepOrange, 'Sophia Jones', quotesList.add(Quotes(Colors.deepOrange, 'Sophia Jones',
'Her name badge read: Hello! My name is DIE, DEMIGOD SCUM!')); 'Her name badge read: Hello! My name is DIE, DEMIGOD SCUM!'));
dataList.add(Data(Colors.red, 'Isabella Johnson', quotesList.add(Quotes(Colors.red, 'Isabella Johnson',
'I am about as intimidating as a butterfly.')); 'I am about as intimidating as a butterfly.'));
dataList.add(Data(Colors.purple, 'Emily Taylor', quotesList.add(Quotes(Colors.purple, 'Emily Taylor',
'Never ask an elf for help; they might decide your better off dead, eh?')); 'Never ask an elf for help; they might decide your better off dead, eh?'));
dataList.add(Data(Colors.green, 'Maya Thomas', 'Act first, explain later')); quotesList
.add(Quotes(Colors.green, 'Maya Thomas', 'Act first, explain later'));
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.symmetric(horizontal: 10),
child: ListView.separated( child: ListView.separated(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
// physics: BouncingScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
itemBuilder: (builder, index) { itemBuilder: (builder, index) {
return LimitedBox( return LimitedBox(
maxHeight: 150, maxHeight: 150,
child: Container( child: Container(
decoration: new BoxDecoration( decoration: BoxDecoration(
color: dataList[index].color, color: quotesList[index].color,
borderRadius: new BorderRadius.all( borderRadius: const BorderRadius.all(
const Radius.circular(10.0), Radius.circular(10.0),
)), )),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -169,8 +171,8 @@ class _AuthorList extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: Text( child: Text(
dataList[index].name, quotesList[index].author,
style: TextStyle( style: const TextStyle(
fontFamily: 'BalsamiqSans_Blod', fontFamily: 'BalsamiqSans_Blod',
fontSize: 30, fontSize: 30,
color: Colors.white), color: Colors.white),
@ -179,8 +181,8 @@ class _AuthorList extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Text( child: Text(
dataList[index].detail, quotesList[index].quote,
style: TextStyle( style: const TextStyle(
fontFamily: 'BalsamiqSans_Regular', fontFamily: 'BalsamiqSans_Regular',
fontSize: 15, fontSize: 15,
color: Colors.white), color: Colors.white),
@ -192,26 +194,27 @@ class _AuthorList extends StatelessWidget {
); );
}, },
separatorBuilder: (builder, index) { separatorBuilder: (builder, index) {
return Divider( return const Divider(
height: 10, height: 10,
thickness: 0, thickness: 0,
); );
}, },
itemCount: dataList.length), itemCount: quotesList.length),
); );
} }
} }
class Data { class Quotes {
MaterialColor color; final MaterialColor color;
String name; final String author;
String detail; final String quote;
Data(this.color, this.name, this.detail); Quotes(this.color, this.author, this.quote);
} }
class ColoursHelper { class Menu {
static Color blue() => Color(0xff5e6ceb); final IconData iconData;
final String title;
static Color blueDark() => Color(0xff4D5DFB); Menu(this.iconData, this.title);
} }

@ -1,18 +1,18 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
class SliderShadow { class SliderBoxShadow {
final Color shadowColor; final Color color;
///[double] you can change blurRadius of shadow by this parameter [shadowBlurRadius] ///[double] you can change blurRadius of shadow by this parameter [blurRadius]
/// ///
final double shadowBlurRadius; final double blurRadius;
///[double] you can change spreadRadius of shadow by this parameter [shadowSpreadRadius] ///[double] you can change spreadRadius of shadow by this parameter [spreadRadius]
/// ///
final double shadowSpreadRadius; final double spreadRadius;
SliderShadow( SliderBoxShadow(
{this.shadowColor = const Color(0xFF9E9E9E), {this.color = const Color(0xFF9E9E9E),
this.shadowBlurRadius = 25.0, this.blurRadius = 25.0,
this.shadowSpreadRadius = 5.0}); this.spreadRadius = 5.0});
} }

@ -6,6 +6,7 @@ class Utils {
/// ///
/// This method get Offset base on [sliderOpen] type /// This method get Offset base on [sliderOpen] type
/// ///
Utils._();
static Offset getOffsetValues(SlideDirection direction, double value) { static Offset getOffsetValues(SlideDirection direction, double value) {
switch (direction) { switch (direction) {

@ -3,6 +3,7 @@ import 'package:flutter_slider_drawer/src/app_bar.dart';
import 'package:flutter_slider_drawer/src/helper/slider_app_bar.dart'; import 'package:flutter_slider_drawer/src/helper/slider_app_bar.dart';
import 'package:flutter_slider_drawer/src/helper/slider_shadow.dart'; import 'package:flutter_slider_drawer/src/helper/slider_shadow.dart';
import 'package:flutter_slider_drawer/src/helper/utils.dart'; import 'package:flutter_slider_drawer/src/helper/utils.dart';
import 'package:flutter_slider_drawer/src/slider_shadow.dart';
import 'package:flutter_slider_drawer/src/slider_bar.dart'; import 'package:flutter_slider_drawer/src/slider_bar.dart';
import 'package:flutter_slider_drawer/src/slider_direction.dart'; import 'package:flutter_slider_drawer/src/slider_direction.dart';
@ -74,8 +75,8 @@ class SliderDrawer extends StatefulWidget {
/// ///
final Color splashColor; final Color splashColor;
///[SliderShadow] you can enable shadow of [child] Widget by this parameter ///[SliderBoxShadow] you can enable shadow of [child] Widget by this parameter
final SliderShadow? sliderShadow; final SliderBoxShadow? sliderBoxShadow;
///[slideDirection] you can change slide direction by this parameter [slideDirection] ///[slideDirection] you can change slide direction by this parameter [slideDirection]
///There are three type of [SlideDirection] ///There are three type of [SlideDirection]
@ -101,7 +102,7 @@ class SliderDrawer extends StatefulWidget {
this.splashColor = const Color(0xffffff), this.splashColor = const Color(0xffffff),
this.sliderCloseSize = 0, this.sliderCloseSize = 0,
this.slideDirection = SlideDirection.LEFT_TO_RIGHT, this.slideDirection = SlideDirection.LEFT_TO_RIGHT,
this.sliderShadow, this.sliderBoxShadow,
this.appBar = const SliderAppBar(), this.appBar = const SliderAppBar(),
this.isCupertino = false}) this.isCupertino = false})
: super(key: key); : super(key: key);
@ -117,27 +118,27 @@ class SliderDrawerState extends State<SliderDrawer>
static const double BLUR_SHADOW = 20.0; static const double BLUR_SHADOW = 20.0;
double _percent = 0.0; double _percent = 0.0;
AnimationController? _animationDrawerController; late AnimationController _animationDrawerController;
late Animation _animation; late Animation _animation;
bool _isDragging = false; bool _isDragging = false;
/// check whether drawer is open /// check whether drawer is open
bool get isDrawerOpen => _animationDrawerController!.isCompleted; bool get isDrawerOpen => _animationDrawerController.isCompleted;
/// it's provide [animationController] for handle and lister drawer animation /// it's provide [animationController] for handle and lister drawer animation
AnimationController? get animationController => _animationDrawerController; AnimationController get animationController => _animationDrawerController;
/// Toggle drawer /// Toggle drawer
void toggle() => _animationDrawerController!.isCompleted void toggle() => _animationDrawerController.isCompleted
? _animationDrawerController!.reverse() ? _animationDrawerController.reverse()
: _animationDrawerController!.forward(); : _animationDrawerController.forward();
/// Open slider /// Open slider
void openSlider() => _animationDrawerController!.forward(); void openSlider() => _animationDrawerController.forward();
/// Close slider /// Close slider
void closeSlider() => _animationDrawerController!.reverse(); void closeSlider() => _animationDrawerController.reverse();
Color _appBarColor = Color(0xffffffff); Color _appBarColor = Color(0xffffffff);
@override @override
@ -151,7 +152,7 @@ class SliderDrawerState extends State<SliderDrawer>
_animation = _animation =
Tween<double>(begin: widget.sliderCloseSize, end: widget.sliderOpenSize) Tween<double>(begin: widget.sliderCloseSize, end: widget.sliderOpenSize)
.animate(CurvedAnimation( .animate(CurvedAnimation(
parent: _animationDrawerController!, parent: _animationDrawerController,
curve: Curves.decelerate, curve: Curves.decelerate,
reverseCurve: Curves.decelerate)); reverseCurve: Curves.decelerate));
if (widget.appBar is SliderAppBar) { if (widget.appBar is SliderAppBar) {
@ -162,29 +163,29 @@ class SliderDrawerState extends State<SliderDrawer>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constrain) { return LayoutBuilder(builder: (context, constrain) {
return Container( return SizedBox(
child: Stack(children: <Widget>[ child: Stack(children: [
/// Menu ///Menu
SliderBar( SliderBar(
slideDirection: widget.slideDirection, slideDirection: widget.slideDirection,
sliderMenu: widget.slider, sliderMenu: widget.slider,
sliderMenuOpenSize: widget.sliderOpenSize, sliderMenuOpenSize: widget.sliderOpenSize,
), ),
/// Displaying the shadow /// Shadow
if (widget.sliderShadow != null) ...[ if (widget.sliderBoxShadow != null) ...[
_Shadow( SliderShadow(
animationDrawerController: _animationDrawerController, animationDrawerController: _animationDrawerController,
slideDirection: widget.slideDirection, slideDirection: widget.slideDirection,
sliderOpenSize: widget.sliderOpenSize, sliderOpenSize: widget.sliderOpenSize,
animation: _animation, animation: _animation,
sliderShadow: widget.sliderShadow!, sliderBoxShadow: widget.sliderBoxShadow!,
), ),
], ],
//Child //Child
AnimatedBuilder( AnimatedBuilder(
animation: _animationDrawerController!, animation: _animationDrawerController,
builder: (_, child) { builder: (_, child) {
return Transform.translate( return Transform.translate(
offset: Utils.getOffsetValues( offset: Utils.getOffsetValues(
@ -193,7 +194,6 @@ class SliderDrawerState extends State<SliderDrawer>
); );
}, },
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.deferToChild,
onHorizontalDragStart: _onHorizontalDragStart, onHorizontalDragStart: _onHorizontalDragStart,
onHorizontalDragEnd: _onHorizontalDragEnd, onHorizontalDragEnd: _onHorizontalDragEnd,
onHorizontalDragUpdate: (detail) => onHorizontalDragUpdate: (detail) =>
@ -209,7 +209,7 @@ class SliderDrawerState extends State<SliderDrawer>
isCupertino: widget.isCupertino, isCupertino: widget.isCupertino,
slideDirection: widget.slideDirection, slideDirection: widget.slideDirection,
onTap: () => toggle(), onTap: () => toggle(),
animationController: _animationDrawerController!, animationController: _animationDrawerController,
splashColor: widget.splashColor, splashColor: widget.splashColor,
sliderAppBar: widget.appBar as SliderAppBar, sliderAppBar: widget.appBar as SliderAppBar,
), ),
@ -228,18 +228,19 @@ class SliderDrawerState extends State<SliderDrawer>
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
_animationDrawerController!.dispose(); _animationDrawerController.dispose();
} }
void _onHorizontalDragStart(DragStartDetails detail) { void _onHorizontalDragStart(DragStartDetails detail) {
if (!widget.isDraggable) return; if (!widget.isDraggable) return;
//Check use start dragging from left edge / right edge then enable dragging //Check use start dragging from left edge / right edge then enable dragging
final rightSideWidthGesture =
MediaQuery.of(context).size.width - WIDTH_GESTURE;
if ((widget.slideDirection == SlideDirection.LEFT_TO_RIGHT && if ((widget.slideDirection == SlideDirection.LEFT_TO_RIGHT &&
detail.localPosition.dx <= WIDTH_GESTURE) || detail.localPosition.dx <= WIDTH_GESTURE) ||
(widget.slideDirection == SlideDirection.RIGHT_TO_LEFT && (widget.slideDirection == SlideDirection.RIGHT_TO_LEFT &&
detail.localPosition.dx >= detail.localPosition.dx >=
WIDTH_GESTURE) /*&& rightSideWidthGesture) /*&&
detail.localPosition.dy <= widget.appBarHeight*/ detail.localPosition.dy <= widget.appBarHeight*/
) { ) {
this.setState(() { this.setState(() {
@ -270,9 +271,10 @@ class SliderDrawerState extends State<SliderDrawer>
BoxConstraints constraints, BoxConstraints constraints,
) { ) {
if (!widget.isDraggable) return; if (!widget.isDraggable) return;
// open drawer for left/right type drawer // Open Drawer : Slider Open -> Left/Right
if (_isDragging && widget.slideDirection == SlideDirection.LEFT_TO_RIGHT || if (_isDragging &&
widget.slideDirection == SlideDirection.RIGHT_TO_LEFT) { (widget.slideDirection == SlideDirection.LEFT_TO_RIGHT ||
widget.slideDirection == SlideDirection.RIGHT_TO_LEFT)) {
var globalPosition = detail.globalPosition.dx; var globalPosition = detail.globalPosition.dx;
globalPosition = globalPosition < 0 ? 0 : globalPosition; globalPosition = globalPosition < 0 ? 0 : globalPosition;
double position = globalPosition / constraints.maxWidth; double position = globalPosition / constraints.maxWidth;
@ -281,7 +283,7 @@ class SliderDrawerState extends State<SliderDrawer>
: (1 - position); : (1 - position);
move(realPosition); move(realPosition);
} }
// open drawer for top/bottom type drawer // Open Drawer : Slider Open -> Top/Bottom
/*if (dragging && widget.slideDirection == SlideDirection.TOP_TO_BOTTOM) { /*if (dragging && widget.slideDirection == SlideDirection.TOP_TO_BOTTOM) {
var globalPosition = detail.globalPosition.dx; var globalPosition = detail.globalPosition.dx;
globalPosition = globalPosition < 0 ? 0 : globalPosition; globalPosition = globalPosition < 0 ? 0 : globalPosition;
@ -292,7 +294,7 @@ class SliderDrawerState extends State<SliderDrawer>
move(realPosition); move(realPosition);
}*/ }*/
// close drawer for left/right type drawer // Close Drawer : Slider Open -> Left/Right
if (isDrawerOpen && if (isDrawerOpen &&
(widget.slideDirection == SlideDirection.LEFT_TO_RIGHT || (widget.slideDirection == SlideDirection.LEFT_TO_RIGHT ||
widget.slideDirection == SlideDirection.RIGHT_TO_LEFT) && widget.slideDirection == SlideDirection.RIGHT_TO_LEFT) &&
@ -303,63 +305,8 @@ class SliderDrawerState extends State<SliderDrawer>
move(double percent) { move(double percent) {
_percent = percent; _percent = percent;
_animationDrawerController!.value = percent; _animationDrawerController.value = percent;
} }
openOrClose() { openOrClose() => _percent > 0.3 ? openSlider() : closeSlider();
if (_percent > 0.3) {
openSlider();
} else {
closeSlider();
}
}
}
class _Shadow extends StatelessWidget {
const _Shadow({
Key? key,
required AnimationController? animationDrawerController,
required this.animation,
required this.sliderShadow,
required this.slideDirection,
required this.sliderOpenSize,
}) : _animationDrawerController = animationDrawerController,
super(key: key);
final AnimationController? _animationDrawerController;
final Animation animation;
final SliderShadow sliderShadow;
final SlideDirection slideDirection;
final double sliderOpenSize;
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _animationDrawerController!,
builder: (_, child) {
return Transform.translate(
offset: Utils.getOffsetValueForShadow(
slideDirection, animation.value, sliderOpenSize),
child: child,
);
},
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(shape: BoxShape.rectangle, boxShadow: [
BoxShadow(
color: sliderShadow.shadowColor,
blurRadius: sliderShadow.shadowBlurRadius,
// soften the shadow
spreadRadius: sliderShadow.shadowSpreadRadius,
//extend the shadow
offset: Offset(
15.0, // Move to right 15 horizontally
15.0, // Move to bottom 15 Vertically
),
)
]),
),
);
}
} }

@ -18,10 +18,7 @@ class SliderBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var container = Container( var container = SizedBox(width: sliderMenuOpenSize, child: sliderMenu);
width: sliderMenuOpenSize,
child: sliderMenu,
);
switch (slideDirection) { switch (slideDirection) {
case SlideDirection.LEFT_TO_RIGHT: case SlideDirection.LEFT_TO_RIGHT:
return container; return container;

@ -0,0 +1,49 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_slider_drawer/src/helper/utils.dart';
import 'helper/slider_shadow.dart';
import 'slider_direction.dart';
class SliderShadow extends StatelessWidget {
const SliderShadow({
Key? key,
required AnimationController? animationDrawerController,
required this.animation,
required this.sliderBoxShadow,
required this.slideDirection,
required this.sliderOpenSize,
}) : _animationDrawerController = animationDrawerController,
super(key: key);
final AnimationController? _animationDrawerController;
final Animation animation;
final SliderBoxShadow sliderBoxShadow;
final SlideDirection slideDirection;
final double sliderOpenSize;
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _animationDrawerController!,
builder: (_, child) {
return Transform.translate(
offset: Utils.getOffsetValueForShadow(
slideDirection, animation.value, sliderOpenSize),
child: child,
);
},
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(shape: BoxShape.rectangle, boxShadow: [
BoxShadow(
color: sliderBoxShadow.color,
blurRadius: sliderBoxShadow.blurRadius,
spreadRadius: sliderBoxShadow.spreadRadius,
offset: Offset(15.0, 15.0),
)
]),
),
);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 172 KiB

Loading…
Cancel
Save