Fixed issue : #21

master
NikhilVadoliya 2 years ago
parent fb6eefe32c
commit 65efb5dfc8

@ -31,6 +31,7 @@ dependencies:
- Provide shadow of Main screen with customization of shadow colors,blurRadius and spreadRadius - Provide shadow of Main screen with customization of shadow colors,blurRadius and spreadRadius
- Provide RTL(RightToLeft),LTR(LeftToRight) and TTB(TopToBottom) slider open selection - Provide RTL(RightToLeft),LTR(LeftToRight) and TTB(TopToBottom) slider open selection
- Provide Custom Appbar support and you can also use plugin appBar with use of `SliderAppBar` widget - Provide Custom Appbar support and you can also use plugin appBar with use of `SliderAppBar` widget
- If you are using CupertinoApp then pass `isCupertino: true`
# Code # Code
@ -64,6 +65,8 @@ dependencies:
</br> </br>
</br> </br>
# Slider open # Slider open
| SliderOpen.LEFT_TO_RIGHT | SliderOpen.RIGHT_TO_LEFT | SliderOpen.TOP_TO_BOTTOM | | SliderOpen.LEFT_TO_RIGHT | SliderOpen.RIGHT_TO_LEFT | SliderOpen.TOP_TO_BOTTOM |

@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

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

@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0" version: "2.9.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -21,80 +21,94 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "1.0.5"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.3.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_slider_drawer: flutter_slider_drawer:
dependency: "direct main" dependency: "direct main"
description: description:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.2.1" version: "2.1.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10" version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.8.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -106,7 +120,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.9.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -127,34 +141,27 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19" version: "0.4.12"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.2"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.17.6 <3.0.0"

@ -2,7 +2,7 @@ name: example
description: A new Flutter project. description: A new Flutter project.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application. # The following defines the version and build number for your application.
@ -18,29 +18,40 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: ">=2.17.6 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3 cupertino_icons: ^1.0.2
flutter_slider_drawer: flutter_slider_drawer:
path: ../ path: ../
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter. # The following section is specific to Flutter packages.
flutter: flutter:
# The following line ensures that the Material Icons font is # The following line ensures that the Material Icons font is
@ -49,12 +60,12 @@ flutter:
uses-material-design: true uses-material-design: true
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: # assets:
- assets/images/user_profile.jpg # - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see # For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages # https://flutter.dev/assets-and-images/#from-packages

@ -1,7 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_slider_drawer/flutter_slider_drawer.dart'; import 'package:flutter_slider_drawer/flutter_slider_drawer.dart';
import 'package:flutter_slider_drawer/src/helper/slider_app_bar.dart';
import 'package:flutter_slider_drawer/src/slider_direction.dart';
class SAppBar extends StatelessWidget { class SAppBar extends StatelessWidget {
final Color splashColor; final Color splashColor;
@ -11,14 +10,16 @@ class SAppBar extends StatelessWidget {
final SlideDirection slideDirection; final SlideDirection slideDirection;
final SliderAppBar sliderAppBar; final SliderAppBar sliderAppBar;
final bool isCupertino;
const SAppBar( const SAppBar(
{Key? key, {Key? key,
this.splashColor = Colors.black, this.splashColor = const Color(0xff000000),
required this.animationController, required this.animationController,
required this.onTap, required this.onTap,
required this.slideDirection, required this.slideDirection,
required this.sliderAppBar}) required this.sliderAppBar,
this.isCupertino = false})
: super(key: key); : super(key: key);
@override @override
@ -36,26 +37,27 @@ class SAppBar extends StatelessWidget {
List<Widget> appBar() { List<Widget> appBar() {
List<Widget> list = [ List<Widget> list = [
sliderAppBar.drawerIcon ?? if (sliderAppBar.drawerIcon == null)
IconButton( isCupertino
splashColor: splashColor, ? AnimatedCupertinoIcon(
icon: AnimatedIcon( progress: animationController,
icon: AnimatedIcons.menu_close, onTap: () => onTap(),
color: sliderAppBar.drawerIconColor,
size: sliderAppBar.drawerIconSize,
progress: animationController),
onPressed: () => onTap()),
Expanded(
child: sliderAppBar.isTitleCenter
? Center(
child: sliderAppBar.title,
) )
: sliderAppBar.title, : IconButton(
), splashColor: splashColor,
sliderAppBar.trailing ?? icon: AnimatedIcon(
SizedBox( icon: AnimatedIcons.menu_close,
width: 35, color: sliderAppBar.drawerIconColor,
) size: sliderAppBar.drawerIconSize,
progress: animationController),
onPressed: () => onTap())
else
sliderAppBar.drawerIcon!,
Expanded(
child: sliderAppBar.isTitleCenter
? Center(child: sliderAppBar.title)
: sliderAppBar.title),
sliderAppBar.trailing ?? SizedBox(width: 35)
]; ];
if (slideDirection == SlideDirection.RIGHT_TO_LEFT) { if (slideDirection == SlideDirection.RIGHT_TO_LEFT) {
@ -64,3 +66,44 @@ class SAppBar extends StatelessWidget {
return list; return list;
} }
} }
class AnimatedCupertinoIcon extends StatefulWidget {
final Animation<double> progress;
final VoidCallback onTap;
const AnimatedCupertinoIcon(
{Key? key, required this.progress, required this.onTap})
: super(key: key);
@override
State<AnimatedCupertinoIcon> createState() => _AnimatedCupertinoIconState();
}
class _AnimatedCupertinoIconState extends State<AnimatedCupertinoIcon> {
bool isCompleted = false;
@override
void initState() {
widget.progress.addListener(() {
isCompleted = widget.progress.isCompleted;
setState(() {});
});
super.initState();
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: widget.onTap,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
isCompleted
? CupertinoIcons.clear_thick
: CupertinoIcons.line_horizontal_3,
color: Colors.grey,
size: 25.0),
),
);
}
}

@ -1,4 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
class SliderAppBar extends StatelessWidget { class SliderAppBar extends StatelessWidget {
/// [double] you can change appBar height by this parameter [appBarHeight] /// [double] you can change appBar height by this parameter [appBarHeight]
@ -38,17 +38,17 @@ class SliderAppBar extends StatelessWidget {
/// ///
final double drawerIconSize; final double drawerIconSize;
const SliderAppBar({ const SliderAppBar({
this.appBarHeight = 70, this.appBarHeight = 70,
this.title = const Text( this.title = const Text('AppBar',
'AppBar', style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20)),
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
this.isTitleCenter = true, this.isTitleCenter = true,
this.appBarColor = Colors.white, this.appBarColor = const Color(0xffffffff),
this.appBarPadding = const EdgeInsets.only(top: 24), this.appBarPadding = const EdgeInsets.only(top: 24),
this.trailing, this.trailing,
this.drawerIconColor = Colors.black, this.drawerIconColor = const Color(0xff2c2b2b),
this.drawerIcon, this.drawerIcon,
this.drawerIconSize = 27, this.drawerIconSize = 27,
}); });

@ -1,6 +1,4 @@
import 'dart:ui'; import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
class SliderShadow { class SliderShadow {
final Color shadowColor; final Color shadowColor;
@ -14,7 +12,7 @@ class SliderShadow {
final double shadowSpreadRadius; final double shadowSpreadRadius;
SliderShadow( SliderShadow(
{this.shadowColor = Colors.grey, {this.shadowColor = const Color(0xFF9E9E9E),
this.shadowBlurRadius = 25.0, this.shadowBlurRadius = 25.0,
this.shadowSpreadRadius = 5.0}); this.shadowSpreadRadius = 5.0});
} }

@ -1,10 +1,9 @@
import 'package:flutter/animation.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slider_drawer/src/app_bar.dart'; 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/slider_bar.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_bar.dart';
import 'package:flutter_slider_drawer/src/slider_direction.dart'; import 'package:flutter_slider_drawer/src/slider_direction.dart';
/// SliderDrawer which have two [child] and [slider] parameter /// SliderDrawer which have two [child] and [slider] parameter
@ -88,6 +87,10 @@ class SliderDrawer extends StatefulWidget {
/// ///
final SlideDirection slideDirection; final SlideDirection slideDirection;
///[bool] if you use CupertinoApp then it will true otherwise it will false
///
final bool isCupertino;
const SliderDrawer( const SliderDrawer(
{Key? key, {Key? key,
required this.slider, required this.slider,
@ -95,11 +98,12 @@ class SliderDrawer extends StatefulWidget {
this.isDraggable = true, this.isDraggable = true,
this.animationDuration = 400, this.animationDuration = 400,
this.sliderOpenSize = 265, this.sliderOpenSize = 265,
this.splashColor = Colors.transparent, 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.sliderShadow,
this.appBar = const SliderAppBar()}) this.appBar = const SliderAppBar(),
this.isCupertino = false})
: super(key: key); : super(key: key);
@override @override
@ -134,6 +138,7 @@ class SliderDrawerState extends State<SliderDrawer>
/// Close slider /// Close slider
void closeSlider() => _animationDrawerController!.reverse(); void closeSlider() => _animationDrawerController!.reverse();
Color _appBarColor = Color(0xffffffff);
@override @override
void initState() { void initState() {
@ -149,14 +154,13 @@ class SliderDrawerState extends State<SliderDrawer>
parent: _animationDrawerController!, parent: _animationDrawerController!,
curve: Curves.decelerate, curve: Curves.decelerate,
reverseCurve: Curves.decelerate)); reverseCurve: Curves.decelerate));
if (widget.appBar is SliderAppBar) {
_appBarColor = (widget.appBar as SliderAppBar).appBarColor;
}
} }
@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>[
@ -197,11 +201,12 @@ class SliderDrawerState extends State<SliderDrawer>
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
color: appBarColor, color: _appBarColor,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
if (widget.appBar != null && widget.appBar is SliderAppBar) if (widget.appBar != null && widget.appBar is SliderAppBar)
SAppBar( SAppBar(
isCupertino: widget.isCupertino,
slideDirection: widget.slideDirection, slideDirection: widget.slideDirection,
onTap: () => toggle(), onTap: () => toggle(),
animationController: _animationDrawerController!, animationController: _animationDrawerController!,

Loading…
Cancel
Save