-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [MDS-390] Add MoonTooltip (#53)
- Loading branch information
Showing
27 changed files
with
1,776 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,5 @@ migrate_working_dir/ | |
.dart_tool/ | ||
.packages | ||
build/ | ||
|
||
.fvm/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import 'package:example/src/storybook/common/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'; | ||
|
||
class TooltipStory extends Story { | ||
TooltipStory() | ||
: super( | ||
name: "Tooltip", | ||
builder: (context) { | ||
final customLabelTextKnob = context.knobs.text( | ||
label: "Custom label text", | ||
initial: "Custom tooltip text", | ||
); | ||
|
||
final tooltipPositionsKnob = context.knobs.options( | ||
label: "tooltipPosition", | ||
description: "Tooltip position variants.", | ||
initial: MoonTooltipPosition.top, | ||
options: const [ | ||
Option(label: "top", value: MoonTooltipPosition.top), | ||
Option(label: "bottom", value: MoonTooltipPosition.bottom), | ||
Option(label: "left", value: MoonTooltipPosition.left), | ||
Option(label: "right", value: MoonTooltipPosition.right), | ||
], | ||
); | ||
|
||
final showTooltipKnob = context.knobs.boolean( | ||
label: "show", | ||
description: "Show the tooltip.", | ||
initial: true, | ||
); | ||
|
||
final showArrowKnob = context.knobs.boolean( | ||
label: "hasArrow", | ||
description: "Does tooltip have an arrow (tail).", | ||
initial: true, | ||
); | ||
|
||
final showShadowKnob = context.knobs.boolean( | ||
label: "Show shadow", | ||
description: "Show shadows under the tooltip.", | ||
initial: true, | ||
); | ||
|
||
final colorsKnob = context.knobs.options( | ||
label: "backgroundColor", | ||
description: "MoonColors variants for base MoonButton.", | ||
initial: 4, // gohan | ||
options: colorOptions, | ||
); | ||
|
||
final color = colorTable(context)[colorsKnob]; | ||
|
||
/* final setRtlModeKnob = context.knobs.boolean( | ||
label: "RTL mode", | ||
description: "Switch between LTR and RTL modes.", | ||
); */ | ||
|
||
return Directionality( | ||
textDirection: /* setRtlModeKnob ? TextDirection.rtl : */ TextDirection.ltr, | ||
child: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
const SizedBox(height: 64), | ||
const TextDivider(text: "Customisable tooltip"), | ||
const SizedBox(height: 32), | ||
MoonTooltip( | ||
show: showTooltipKnob, | ||
tooltipPosition: tooltipPositionsKnob, | ||
hasArrow: showArrowKnob, | ||
backgroundColor: color, | ||
tooltipShadows: showShadowKnob == true ? null : [], | ||
content: Text(customLabelTextKnob), | ||
child: MoonButton( | ||
backgroundColor: context.moonColors!.bulma, | ||
onTap: () {}, | ||
label: const Text("MoonButton"), | ||
), | ||
), | ||
const SizedBox(height: 40), | ||
const TextDivider(text: "Default tooltip"), | ||
const SizedBox(height: 32), | ||
MoonPrimaryButton( | ||
showTooltip: true, | ||
tooltipMessage: customLabelTextKnob, | ||
onTap: () {}, | ||
label: const Text("MoonPrimaryButton"), | ||
), | ||
const SizedBox(height: 32), | ||
MoonChip( | ||
showTooltip: true, | ||
tooltipMessage: customLabelTextKnob, | ||
borderRadius: BorderRadius.circular(20), | ||
backgroundColor: context.moonColors!.hit, | ||
leftIcon: const Icon(MoonIcons.frame24), | ||
label: const Text("MoonChip"), | ||
), | ||
const SizedBox(height: 64), | ||
], | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.