Skip to content

Commit d1f2528

Browse files
fix code format
1 parent d6a1d1e commit d1f2528

11 files changed

+170
-81
lines changed

example/lib/detailscreen.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ class _DetailState extends State<Detail> {
8383
children: [
8484
TextSpan(text: 'Hi team,\n\n'),
8585
TextSpan(
86-
text: 'As some of you know, we’re moving to Slack for '
86+
text:
87+
'As some of you know, we’re moving to Slack for '
8788
'our internal team communications. Slack is a '
8889
'messaging app where we can talk, share files, '
8990
'and work together. It also connects with tools '
@@ -98,7 +99,8 @@ class _DetailState extends State<Detail> {
9899
),
99100
),
100101
TextSpan(
101-
text: 'We want to use the best communication tools to '
102+
text:
103+
'We want to use the best communication tools to '
102104
'make our lives easier and be more productive. '
103105
'Having everything in one place will help us '
104106
'work together better and faster, rather than '

example/lib/mail_page.dart

+10-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class _MailPageState extends State<MailPage> {
3131
//NOTE: remove ambiguate function if you are using
3232
//flutter version greater than 3.x and direct use WidgetsBinding.instance
3333
ambiguate(WidgetsBinding.instance)?.addPostFrameCallback(
34-
(_) => ShowCaseWidget.of(context).startShowCase([_one, _two, firstMutliWidgetKey]),
34+
(_) => ShowCaseWidget.of(context)
35+
.startShowCase([_one, _two, firstMutliWidgetKey]),
3536
);
3637
mails = [
3738
Mail(
@@ -145,7 +146,8 @@ class _MailPageState extends State<MailPage> {
145146
description: 'Tap to see menu options',
146147
disableDefaultTargetGestures: true,
147148
child: GestureDetector(
148-
onTap: () => debugPrint('menu button clicked'),
149+
onTap: () =>
150+
debugPrint('menu button clicked'),
149151
child: Icon(
150152
Icons.menu,
151153
color: Theme.of(context).primaryColor,
@@ -155,22 +157,25 @@ class _MailPageState extends State<MailPage> {
155157
previous: ActionButtonConfig(
156158
icon: Image.asset(
157159
'assets/left.png',
158-
color: Theme.of(context).primaryColor,
160+
color:
161+
Theme.of(context).primaryColor,
159162
),
160163
buttonTextVisible: false,
161164
),
162165
next: ActionButtonConfig(
163166
icon: Image.asset(
164167
'assets/right.png',
165-
color: Theme.of(context).primaryColor,
168+
color:
169+
Theme.of(context).primaryColor,
166170
),
167171
textDirection: TextDirection.rtl,
168172
buttonTextVisible: false,
169173
),
170174
stop: ActionButtonConfig(
171175
icon: Image.asset(
172176
'assets/close.png',
173-
color: Theme.of(context).primaryColor,
177+
color:
178+
Theme.of(context).primaryColor,
174179
),
175180
buttonTextVisible: false,
176181
),

example/lib/widget/mail_tile.dart

+8-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class MailTile extends StatelessWidget {
3737
mail.sender,
3838
overflow: TextOverflow.ellipsis,
3939
style: TextStyle(
40-
fontWeight: mail.isUnread ? FontWeight.bold : FontWeight.normal,
40+
fontWeight: mail.isUnread
41+
? FontWeight.bold
42+
: FontWeight.normal,
4143
fontSize: 17,
4244
),
4345
),
@@ -54,7 +56,9 @@ class MailTile extends StatelessWidget {
5456
overflow: TextOverflow.ellipsis,
5557
style: TextStyle(
5658
fontWeight: FontWeight.normal,
57-
color: mail.isUnread ? Theme.of(context).primaryColor : Colors.black,
59+
color: mail.isUnread
60+
? Theme.of(context).primaryColor
61+
: Colors.black,
5862
fontSize: 15,
5963
),
6064
),
@@ -84,7 +88,8 @@ class MailTile extends StatelessWidget {
8488
),
8589
Icon(
8690
mail.isUnread ? Icons.star : Icons.star_border,
87-
color: mail.isUnread ? const Color(0xffFFFFFF) : Colors.grey,
91+
color:
92+
mail.isUnread ? const Color(0xffFFFFFF) : Colors.grey,
8893
),
8994
],
9095
),

example/lib/widget/skip_tool_tip.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ class ShipToolTip extends StatelessWidget {
6464
],
6565
);
6666
}
67-
}
67+
}

lib/src/get_position.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class GetPosition {
4848
final rect = Rect.fromLTRB(
4949
topLeft.dx - padding.left < 0 ? 0 : topLeft.dx - padding.left,
5050
topLeft.dy - padding.top < 0 ? 0 : topLeft.dy - padding.top,
51-
bottomRight.dx + padding.right > screenWidth! ? screenWidth! : bottomRight.dx + padding.right,
51+
bottomRight.dx + padding.right > screenWidth!
52+
? screenWidth!
53+
: bottomRight.dx + padding.right,
5254
bottomRight.dy + padding.bottom > screenHeight!
5355
? screenHeight!
5456
: bottomRight.dy + padding.bottom,
@@ -88,7 +90,8 @@ class GetPosition {
8890
final box = key.currentContext!.findRenderObject() as RenderBox;
8991
final boxOffset = box.globalToLocal(const Offset(0.0, 0.0));
9092
if (boxOffset.dx.isNaN) return padding.right;
91-
final bottomRight = box.size.bottomRight(box.localToGlobal(const Offset(0.0, 0.0)));
93+
final bottomRight =
94+
box.size.bottomRight(box.localToGlobal(const Offset(0.0, 0.0)));
9295
return bottomRight.dx - boxOffset.dx;
9396
}
9497

lib/src/measure_size.dart

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import 'package:flutter/material.dart';
2424
import 'package:flutter/scheduler.dart';
2525

26-
2726
typedef OnWidgetSizeChange = void Function(Size? size);
2827

2928
class MeasureSize extends StatefulWidget {
@@ -43,8 +42,7 @@ class MeasureSize extends StatefulWidget {
4342
class _MeasureSizeState extends State<MeasureSize> {
4443
@override
4544
Widget build(BuildContext context) {
46-
SchedulerBinding.instance
47-
.addPostFrameCallback(postFrameCallback);
45+
SchedulerBinding.instance.addPostFrameCallback(postFrameCallback);
4846
return Container(
4947
key: widgetKey,
5048
child: widget.child,

lib/src/showcase.dart

+47-24
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ class Showcase extends StatefulWidget {
265265
this.movingAnimationDuration = const Duration(milliseconds: 2000),
266266
this.disableMovingAnimation,
267267
this.disableScaleAnimation,
268-
this.tooltipPadding = const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
268+
this.tooltipPadding =
269+
const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
269270
this.onToolTipClick,
270271
this.targetPadding = EdgeInsets.zero,
271272
this.blurValue,
@@ -290,7 +291,10 @@ class Showcase extends StatefulWidget {
290291
"overlay opacity must be between 0 and 1."),
291292
assert(onTargetClick == null || disposeOnTap != null,
292293
"disposeOnTap is required if you're using onTargetClick"),
293-
assert(disposeOnTap == null ? true : (onTargetClick == null ? false : true),
294+
assert(
295+
disposeOnTap == null
296+
? true
297+
: (onTargetClick == null ? false : true),
294298
"onTargetClick is required if you're using disposeOnTap"),
295299
super(key: key);
296300

@@ -309,8 +313,8 @@ class Showcase extends StatefulWidget {
309313
this.overlayColor = Colors.black45,
310314
this.targetBorderRadius,
311315
this.overlayOpacity = 0.75,
312-
this.scrollLoadingWidget =
313-
const CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(Colors.white)),
316+
this.scrollLoadingWidget = const CircularProgressIndicator(
317+
valueColor: AlwaysStoppedAnimation(Colors.white)),
314318
this.onTargetClick,
315319
this.disposeOnTap,
316320
this.movingAnimationDuration = const Duration(milliseconds: 2000),
@@ -387,7 +391,9 @@ class _ShowcaseState extends State<Showcase> {
387391
}
388392

389393
if (showCaseWidgetState.autoPlay) {
390-
timer = Timer(Duration(seconds: showCaseWidgetState.autoPlayDelay.inSeconds), _nextIfAny);
394+
timer = Timer(
395+
Duration(seconds: showCaseWidgetState.autoPlayDelay.inSeconds),
396+
_nextIfAny);
391397
}
392398
}
393399
}
@@ -456,13 +462,14 @@ class _ShowcaseState extends State<Showcase> {
456462
if (widget.keys != null && widget.keys!.isNotEmpty) {
457463
// loop through all keys and build a list of widgets to be displayed
458464
for (final element in widget.keys!) {
459-
RenderRepaintBoundary? boundary =
460-
element.currentContext!.findRenderObject() as RenderRepaintBoundary?;
465+
RenderRepaintBoundary? boundary = element.currentContext!
466+
.findRenderObject() as RenderRepaintBoundary?;
461467
// if (boundary == null) return await const SizedBox.shrink();
462468
ui.Image image = await boundary!.toImage(pixelRatio: 2.0);
463469
final BuildContext context = element.currentContext!;
464470
RenderBox? renderBox;
465-
if (context.mounted) renderBox = context.findRenderObject() as RenderBox?;
471+
if (context.mounted)
472+
renderBox = context.findRenderObject() as RenderBox?;
466473
Offset offset = renderBox!.localToGlobal(Offset.zero);
467474
list.add(
468475
Positioned(
@@ -475,7 +482,8 @@ class _ShowcaseState extends State<Showcase> {
475482
image: DecorationImage(
476483
image: MemoryImage(
477484
Uint8List.fromList(
478-
(await image.toByteData(format: ui.ImageByteFormat.png))!
485+
(await image.toByteData(
486+
format: ui.ImageByteFormat.png))!
479487
.buffer
480488
.asUint8List(),
481489
),
@@ -544,25 +552,32 @@ class _ShowcaseState extends State<Showcase> {
544552
clipper: RRectClipper(
545553
area: _isScrollRunning ? Rect.zero : rectBound,
546554
isCircle: widget.targetShapeBorder is CircleBorder,
547-
radius: _isScrollRunning ? BorderRadius.zero : widget.targetBorderRadius,
548-
overlayPadding: _isScrollRunning ? EdgeInsets.zero : widget.targetPadding,
555+
radius: _isScrollRunning
556+
? BorderRadius.zero
557+
: widget.targetBorderRadius,
558+
overlayPadding: _isScrollRunning
559+
? EdgeInsets.zero
560+
: widget.targetPadding,
549561
),
550562
child: blur != 0
551563
? BackdropFilter(
552-
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
564+
filter:
565+
ImageFilter.blur(sigmaX: blur, sigmaY: blur),
553566
child: Container(
554567
width: MediaQuery.sizeOf(context).width,
555568
height: MediaQuery.sizeOf(context).height,
556569
decoration: BoxDecoration(
557-
color: widget.overlayColor.withOpacity(widget.overlayOpacity),
570+
color: widget.overlayColor
571+
.withOpacity(widget.overlayOpacity),
558572
),
559573
),
560574
)
561575
: Container(
562576
width: MediaQuery.sizeOf(context).width,
563577
height: MediaQuery.sizeOf(context).height,
564578
decoration: BoxDecoration(
565-
color: widget.overlayColor.withOpacity(widget.overlayOpacity),
579+
color: widget.overlayColor
580+
.withOpacity(widget.overlayOpacity),
566581
),
567582
),
568583
),
@@ -577,12 +592,17 @@ class _ShowcaseState extends State<Showcase> {
577592
clipper: RRectClipper(
578593
area: _isScrollRunning ? Rect.zero : rectBound,
579594
isCircle: widget.targetShapeBorder is CircleBorder,
580-
radius: _isScrollRunning ? BorderRadius.zero : widget.targetBorderRadius,
581-
overlayPadding: _isScrollRunning ? EdgeInsets.zero : widget.targetPadding,
595+
radius: _isScrollRunning
596+
? BorderRadius.zero
597+
: widget.targetBorderRadius,
598+
overlayPadding: _isScrollRunning
599+
? EdgeInsets.zero
600+
: widget.targetPadding,
582601
),
583602
child: blur != 0
584603
? BackdropFilter(
585-
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
604+
filter:
605+
ImageFilter.blur(sigmaX: blur, sigmaY: blur),
586606
child: Container(
587607
width: MediaQuery.sizeOf(context).width,
588608
height: MediaQuery.sizeOf(context).height,
@@ -595,7 +615,8 @@ class _ShowcaseState extends State<Showcase> {
595615
width: MediaQuery.sizeOf(context).width,
596616
height: MediaQuery.sizeOf(context).height,
597617
decoration: BoxDecoration(
598-
color: widget.overlayColor.withOpacity(widget.overlayOpacity),
618+
color: widget.overlayColor
619+
.withOpacity(widget.overlayOpacity),
599620
),
600621
),
601622
),
@@ -610,12 +631,14 @@ class _ShowcaseState extends State<Showcase> {
610631
onDoubleTap: widget.onTargetDoubleTap,
611632
onLongPress: widget.onTargetLongPress,
612633
shapeBorder: widget.targetShapeBorder,
613-
disableDefaultChildGestures: widget.disableDefaultTargetGestures,
634+
disableDefaultChildGestures:
635+
widget.disableDefaultTargetGestures,
614636
),
615637
if (widget.keys != null && widget.keys!.isNotEmpty) ...[
616638
FutureBuilder<List<Widget>>(
617639
future: _buildCopys(context),
618-
builder: (context, AsyncSnapshot<List<Widget>> snapshot) {
640+
builder:
641+
(context, AsyncSnapshot<List<Widget>> snapshot) {
619642
if (snapshot.hasData &&
620643
snapshot.data != null &&
621644
snapshot.data!.isNotEmpty) {
@@ -645,10 +668,10 @@ class _ShowcaseState extends State<Showcase> {
645668
contentWidth: widget.width,
646669
onTooltipTap: _getOnTooltipTap,
647670
tooltipPadding: widget.tooltipPadding,
648-
disableMovingAnimation:
649-
widget.disableMovingAnimation ?? showCaseWidgetState.disableMovingAnimation,
650-
disableScaleAnimation:
651-
widget.disableScaleAnimation ?? showCaseWidgetState.disableScaleAnimation,
671+
disableMovingAnimation: widget.disableMovingAnimation ??
672+
showCaseWidgetState.disableMovingAnimation,
673+
disableScaleAnimation: widget.disableScaleAnimation ??
674+
showCaseWidgetState.disableScaleAnimation,
652675
movingAnimationDuration: widget.movingAnimationDuration,
653676
tooltipBorderRadius: widget.tooltipBorderRadius,
654677
scaleAnimationDuration: widget.scaleAnimationDuration,

lib/src/showcase_default_actions.dart

+14-8
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class ShowCaseDefaultActions extends StatelessWidget {
5151
previous.text ?? 'Previous',
5252
previous.callback ??
5353
() {
54-
if (showcaseContext != null && ShowCaseWidget.of(showcaseContext).ids != null) {
54+
if (showcaseContext != null &&
55+
ShowCaseWidget.of(showcaseContext).ids != null) {
5556
ShowCaseWidget.of(showcaseContext).previous();
5657
}
5758
},
@@ -66,7 +67,8 @@ class ShowCaseDefaultActions extends StatelessWidget {
6667
stop.text ?? 'Stop',
6768
stop.callback ??
6869
() {
69-
if (showcaseContext != null && ShowCaseWidget.of(showcaseContext).ids != null) {
70+
if (showcaseContext != null &&
71+
ShowCaseWidget.of(showcaseContext).ids != null) {
7072
ShowCaseWidget.of(showcaseContext).dismiss();
7173
}
7274
},
@@ -79,9 +81,12 @@ class ShowCaseDefaultActions extends StatelessWidget {
7981
next.text ?? 'Next',
8082
next.callback ??
8183
() {
82-
if (showcaseContext != null && ShowCaseWidget.of(showcaseContext).ids != null) {
83-
ShowCaseWidget.of(showcaseContext).completed(ShowCaseWidget.of(showcaseContext)
84-
.ids![ShowCaseWidget.of(showcaseContext).activeWidgetId ?? 0]);
84+
if (showcaseContext != null &&
85+
ShowCaseWidget.of(showcaseContext).ids != null) {
86+
ShowCaseWidget.of(showcaseContext).completed(
87+
ShowCaseWidget.of(showcaseContext).ids![
88+
ShowCaseWidget.of(showcaseContext).activeWidgetId ??
89+
0]);
8590
}
8691
},
8792
),
@@ -97,8 +102,8 @@ class ShowCaseDefaultActions extends StatelessWidget {
97102
);
98103
}
99104

100-
Widget _getButtonWidget(ActionButtonConfig actionConfig, BuildContext? showcaseContext,
101-
String buttonText, VoidCallback onClick) {
105+
Widget _getButtonWidget(ActionButtonConfig actionConfig,
106+
BuildContext? showcaseContext, String buttonText, VoidCallback onClick) {
102107
return Expanded(
103108
child: Directionality(
104109
textDirection: actionConfig.textDirection,
@@ -111,7 +116,8 @@ class ShowCaseDefaultActions extends StatelessWidget {
111116
: const SizedBox.shrink(),
112117
icon: actionConfig.icon ?? const SizedBox.shrink(),
113118
style: ButtonStyle(
114-
backgroundColor: MaterialStateProperty.all<Color>(actionConfig.textButtonBgColor)),
119+
backgroundColor: MaterialStateProperty.all<Color>(
120+
actionConfig.textButtonBgColor)),
115121
onPressed: onClick,
116122
),
117123
),

lib/src/showcase_widget.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ class ShowCaseWidget extends StatefulWidget {
102102
}) : super(key: key);
103103

104104
static GlobalKey? activeTargetWidget(BuildContext context) {
105-
return context.dependOnInheritedWidgetOfExactType<_InheritedShowCaseView>()?.activeWidgetIds;
105+
return context
106+
.dependOnInheritedWidgetOfExactType<_InheritedShowCaseView>()
107+
?.activeWidgetIds;
106108
}
107109

108110
static ShowCaseWidgetState of(BuildContext context) {

0 commit comments

Comments
 (0)