Skip to content

Commit

Permalink
fix: [MDS-460] Various minor bug fixes (#95)
Browse files Browse the repository at this point in the history
- Fix buttons with Tooltip are sticky.
- Fix Storybook button naming and colors are inconsistent.
- Fix overlay based stories should start as disabled at start.
  • Loading branch information
Kypsis authored Mar 24, 2023
1 parent 5cbd8e1 commit 4e1772b
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/accordion.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/avatar.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/button.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/checkbox.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/chip.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/circular_loader.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/circular_progress.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/linear_loader.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/linear_progress.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';
Expand Down
6 changes: 3 additions & 3 deletions example/lib/src/storybook/stories/modal.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';
Expand Down Expand Up @@ -69,7 +69,7 @@ class ModalStory extends Story {
Padding(
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
child: Text(
"Reopen the modal to see the new knob value changes.",
"Reopen the modal to view the updated knob value.",
style: context.moonTypography!.body.text14,
),
),
Expand Down Expand Up @@ -100,7 +100,7 @@ class ModalStory extends Story {
Builder(
builder: (context) {
return MoonFilledButton(
label: const Text("Open Modal"),
label: const Text("Tap me"),
onTap: () => modalBuilder(context),
);
},
Expand Down
11 changes: 5 additions & 6 deletions example/lib/src/storybook/stories/popover.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

bool show = false;

class PopoverStory extends Story {
PopoverStory()
: super(
Expand Down Expand Up @@ -65,8 +67,6 @@ class PopoverStory extends Story {
description: "Switch between LTR and RTL modes.",
);

bool show = true;

return Directionality(
textDirection: setRtlModeKnob ? TextDirection.rtl : TextDirection.ltr,
child: Center(
Expand Down Expand Up @@ -112,12 +112,11 @@ class PopoverStory extends Story {
],
),
),
child: MoonButton(
backgroundColor: context.moonColors!.bulma,
child: MoonFilledButton(
onTap: () {
setState(() => show = true);
},
label: const Text("MDS"),
label: const Text("Tap me"),
),
);
},
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/radio.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/switch.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/storybook/stories/tag.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';
Expand Down
13 changes: 6 additions & 7 deletions example/lib/src/storybook/stories/tooltip.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:example/src/storybook/common/options.dart';
import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

bool show = false;

class TooltipStory extends Story {
TooltipStory()
: super(
Expand Down Expand Up @@ -94,8 +96,6 @@ class TooltipStory extends Story {
description: "Switch between LTR and RTL modes.",
);

bool show = true;

return Directionality(
textDirection: setRtlModeKnob ? TextDirection.rtl : TextDirection.ltr,
child: Center(
Expand All @@ -119,18 +119,17 @@ class TooltipStory extends Story {
arrowTipDistance: arrowTipDistanceKnob,
tooltipShadows: showShadowKnob == true ? null : [],
content: Text(customLabelTextKnob),
child: MoonButton(
backgroundColor: context.moonColors!.bulma,
child: MoonFilledButton(
onTap: () {
setState(() => show = true);
},
label: const Text("MDS"),
label: const Text("Tap me"),
),
);
},
),
const SizedBox(height: 40),
const TextDivider(text: "Default tooltip"),
const TextDivider(text: "Default on hover tooltip"),
const SizedBox(height: 32),
MoonFilledButton(
showTooltip: true,
Expand Down
7 changes: 7 additions & 0 deletions lib/src/widgets/common/base_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ class _MoonBaseControlState extends State<MoonBaseControl> {
}
}

void _handleTapCancel() {
if (_isPressed && mounted) {
setState(() => _isPressed = false);
}
}

void _handleLongPress() {
if (widget.onLongPress == null) return;

Expand Down Expand Up @@ -392,6 +398,7 @@ class _MoonBaseControlState extends State<MoonBaseControl> {
onLongPress: _handleLongPress,
onLongPressStart: _handleLongPressStart,
onLongPressUp: _handleLongPressUp,
onTapCancel: _handleTapCancel,
onHorizontalDragStart: _handleHorizontalDragStart,
onHorizontalDragEnd: _handleHorizontalDragEnd,
onVerticalDragStart: _handleVerticalDragStart,
Expand Down

0 comments on commit 4e1772b

Please sign in to comment.