Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https://services.gradle.org/distributions/gradle-6.4.1-all.zip
70 changes: 45 additions & 25 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async';

import 'package:charts_flutter/flutter.dart' as charts;
import 'package:example/util/util.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
Expand Down Expand Up @@ -64,7 +63,7 @@ class _ExampleState extends State<Example> {

Widget buildSheet() {
return SlidingSheet(
duration: const Duration(milliseconds: 900),
openDuration: const Duration(milliseconds: 900),
controller: controller,
color: Colors.white,
shadowColor: Colors.black26,
Expand Down Expand Up @@ -122,8 +121,9 @@ class _ExampleState extends State<Example> {
width: 16,
height: 4,
borderRadius: 2,
color:
Colors.grey.withOpacity(.5 * (1 - interval(0.7, 1.0, state.progress))),
color: Colors.grey.withOpacity(
.5 * (1 - interval(0.7, 1.0, state.progress)),
),
),
),
const SizedBox(height: 8),
Expand Down Expand Up @@ -217,10 +217,13 @@ class _ExampleState extends State<Example> {
() async {
// Inherit from context...
await SheetController.of(context).hide();
Future.delayed(const Duration(milliseconds: 1500), () {
// or use the controller
controller.show();
});
Future.delayed(
const Duration(milliseconds: 1500),
() {
// or use the controller
controller.show();
},
);
},
color: mapsBlue,
),
Expand All @@ -237,9 +240,7 @@ class _ExampleState extends State<Example> {
),
Text(
!isExpanded ? 'Steps & more' : 'Show map',
style: textStyle.copyWith(
fontSize: 15,
),
style: textStyle.copyWith(fontSize: 15),
),
!isExpanded
? () => controller.scrollTo(state.maxScrollExtent)
Expand Down Expand Up @@ -348,11 +349,22 @@ class _ExampleState extends State<Example> {

Widget buildSteps(BuildContext context) {
final steps = [
Step('Go to your pubspec.yaml file.', '2 seconds'),
Step(
"Add the newest version of 'sliding_sheet' to your dependencies.", '5 seconds'),
Step("Run 'flutter packages get' in the terminal.", '4 seconds'),
Step("Happy coding!", 'Forever'),
'Go to your pubspec.yaml file.',
'2 seconds',
),
Step(
"Add the newest version of 'sliding_sheet' to your dependencies.",
'5 seconds',
),
Step(
"Run 'flutter packages get' in the terminal.",
'4 seconds',
),
Step(
"Happy coding!",
'Forever',
),
];

return ListView.builder(
Expand All @@ -370,9 +382,7 @@ class _ExampleState extends State<Example> {
children: <Widget>[
Text(
step.instruction,
style: textStyle.copyWith(
fontSize: 16,
),
style: textStyle.copyWith(fontSize: 16),
),
const SizedBox(height: 16),
Row(
Expand Down Expand Up @@ -489,7 +499,11 @@ class _ExampleState extends State<Example> {

if (backButton || backDrop) {
const duration = Duration(milliseconds: 300);
await controller.snapToExtent(0.2, duration: duration, clamp: false);
await controller.snapToExtent(
0.2,
duration: duration,
clamp: false,
);
await controller.snapToExtent(0.4, duration: duration);
// or Navigator.pop(context);
}
Expand Down Expand Up @@ -519,7 +533,9 @@ class _ExampleState extends State<Example> {
children: <Widget>[
Expanded(
child: Text(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent sagittis tellus lacus, et pulvinar orci eleifend in.',
'Lorem ipsum dolor sit amet, consectetur adipiscing '
'elit. Praesent sagittis tellus lacus, et pulvinar '
'orci eleifend in.',
style: textTheme.subtitle1.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
Expand Down Expand Up @@ -589,13 +605,15 @@ class _ExampleState extends State<Example> {
Align(
alignment: Alignment.topRight,
child: Padding(
padding:
EdgeInsets.fromLTRB(0, MediaQuery.of(context).padding.top + 16, 16, 0),
padding: EdgeInsets.fromLTRB(
0,
MediaQuery.of(context).padding.top + 16,
16,
0,
),
child: FloatingActionButton(
backgroundColor: Colors.white,
onPressed: () async {
await showBottomSheetDialog(context);
},
onPressed: () async => showBottomSheetDialog(context),
child: const Icon(
Icons.layers,
color: mapsBlue,
Expand Down Expand Up @@ -631,6 +649,7 @@ class _ExampleState extends State<Example> {
class Step {
final String instruction;
final String time;

Step(
this.instruction,
this.time,
Expand All @@ -640,6 +659,7 @@ class Step {
class Traffic {
final double intesity;
final String time;

Traffic(
this.intesity,
this.time,
Expand Down
14 changes: 12 additions & 2 deletions example/lib/util/custom_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,21 @@ class CustomContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final w = width == null || width == EXPAND ? double.infinity : width == WRAP ? null : width;
final w = width == null || width == EXPAND
? double.infinity
: width == WRAP
? null
: width;
final h = height == EXPAND ? double.infinity : height;
final br = customBorders ??
BorderRadius.circular(
boxShape == BoxShape.rectangle ? borderRadius : w != null ? w / 2.0 : h != null ? h / 2.0 : 0,
boxShape == BoxShape.rectangle
? borderRadius
: w != null
? w / 2.0
: h != null
? h / 2.0
: 0,
);

Widget content = Padding(
Expand Down
4 changes: 2 additions & 2 deletions example/lib/util/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export 'custom_container.dart';

// ignore_for_file: public_member_api_docs


// Shrinks animation values inside a specified range. E.g. from .2 - .4 => .3 = 50%.
double interval(double lower, double upper, double progress) {
assert(lower < upper);
Expand All @@ -15,4 +14,5 @@ double interval(double lower, double upper, double progress) {
return ((progress - lower) / (upper - lower)).clamp(0.0, 1.0);
}

void postFrame(void Function() callback) => WidgetsBinding.instance.addPostFrameCallback((_) => callback());
void postFrame(void Function() callback) =>
WidgetsBinding.instance.addPostFrameCallback((_) => callback());
42 changes: 21 additions & 21 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,14 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
charts_common:
dependency: transitive
description:
Expand Down Expand Up @@ -56,14 +56,14 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -80,21 +80,28 @@ packages:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.0"
version: "0.16.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+2"
version: "1.0.1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
material_design_icons_flutter:
dependency: "direct main"
description:
Expand All @@ -108,14 +115,14 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -134,7 +141,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -169,21 +176,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "0.4.9"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.2"
sdks:
dart: ">=2.12.0 <3.0.0"
dart: ">=2.17.0 <3.0.0"
flutter: ">=0.1.2"
Loading