mirror of
https://github.com/foss42/apidash.git
synced 2025-06-11 15:51:29 +08:00
Migrate to ADFilledButton & ADTextButton
This commit is contained in:
lib/widgets
packages/apidash_design_system/lib
@ -16,10 +16,6 @@ class CopyButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var sm = ScaffoldMessenger.of(context);
|
||||
const icon = Icon(
|
||||
Icons.content_copy,
|
||||
size: 18,
|
||||
);
|
||||
onPressed() async {
|
||||
await Clipboard.setData(ClipboardData(text: toCopy));
|
||||
sm.hideCurrentSnackBar();
|
||||
@ -27,14 +23,15 @@ class CopyButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
return showLabel
|
||||
? TextButton.icon(
|
||||
? ADTextButton(
|
||||
icon: Icons.content_copy,
|
||||
iconSize: kButtonIconSizeLarge,
|
||||
label: kLabelCopy,
|
||||
onPressed: onPressed,
|
||||
icon: icon,
|
||||
label: const Text(kLabelCopy),
|
||||
)
|
||||
: ADIconButton(
|
||||
icon: Icons.content_copy,
|
||||
iconSize: 18,
|
||||
iconSize: kButtonIconSizeLarge,
|
||||
tooltip: kLabelCopy,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
visualDensity: VisualDensity.compact,
|
||||
|
@ -14,18 +14,13 @@ class DiscordButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var label = text ?? 'Discord Server';
|
||||
return FilledButton.icon(
|
||||
return ADFilledButton(
|
||||
icon: Icons.discord,
|
||||
iconSize: kButtonIconSizeLarge,
|
||||
label: label,
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kDiscordUrl));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.discord,
|
||||
size: 20.0,
|
||||
),
|
||||
label: Text(
|
||||
label,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16,29 +16,13 @@ class RepoButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var label = text ?? "GitHub";
|
||||
if (icon == null) {
|
||||
return FilledButton(
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kGitUrl));
|
||||
},
|
||||
child: Text(
|
||||
label,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
);
|
||||
}
|
||||
return FilledButton.icon(
|
||||
return ADFilledButton(
|
||||
icon: icon,
|
||||
iconSize: kButtonIconSizeLarge,
|
||||
label: label,
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kGitUrl));
|
||||
},
|
||||
icon: Icon(
|
||||
icon,
|
||||
size: 20.0,
|
||||
),
|
||||
label: Text(
|
||||
label,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:apidash_design_system/apidash_design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:apidash/utils/utils.dart';
|
||||
@ -22,11 +23,6 @@ class SaveInDownloadsButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var sm = ScaffoldMessenger.of(context);
|
||||
const icon = Icon(
|
||||
Icons.download,
|
||||
size: 18,
|
||||
);
|
||||
const label = kLabelDownload;
|
||||
final onPressed = (content != null)
|
||||
? () => saveToDownloads(
|
||||
sm,
|
||||
@ -38,17 +34,19 @@ class SaveInDownloadsButton extends StatelessWidget {
|
||||
: null;
|
||||
|
||||
return showLabel
|
||||
? TextButton.icon(
|
||||
? ADTextButton(
|
||||
icon: Icons.download,
|
||||
iconSize: kButtonIconSizeLarge,
|
||||
label: kLabelDownload,
|
||||
onPressed: onPressed,
|
||||
icon: icon,
|
||||
label: const Text(label),
|
||||
)
|
||||
: IconButton(
|
||||
tooltip: label,
|
||||
: ADIconButton(
|
||||
icon: Icons.download,
|
||||
iconSize: kButtonIconSizeLarge,
|
||||
onPressed: onPressed,
|
||||
tooltip: kLabelDownload,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
visualDensity: VisualDensity.compact,
|
||||
onPressed: onPressed,
|
||||
icon: icon,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16,34 +16,31 @@ class SendButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FilledButton(
|
||||
return ADFilledButton(
|
||||
onPressed: isWorking ? onCancel : onTap,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: isWorking
|
||||
? const [
|
||||
Text(
|
||||
kLabelCancel,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
kHSpacer10,
|
||||
Icon(
|
||||
size: 16,
|
||||
Icons.cancel,
|
||||
)
|
||||
]
|
||||
: const [
|
||||
Text(
|
||||
kLabelSend,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
kHSpacer10,
|
||||
Icon(
|
||||
size: 16,
|
||||
Icons.send,
|
||||
),
|
||||
],
|
||||
),
|
||||
items: isWorking
|
||||
? const [
|
||||
Text(
|
||||
kLabelCancel,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
kHSpacer10,
|
||||
Icon(
|
||||
size: 16,
|
||||
Icons.cancel,
|
||||
)
|
||||
]
|
||||
: const [
|
||||
Text(
|
||||
kLabelSend,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
kHSpacer10,
|
||||
Icon(
|
||||
size: 16,
|
||||
Icons.send,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user