Skip to content

Update icon and tooltip for reload. #3237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 9, 2025
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
Binary file added pkgs/dartpad_ui/assets/hot-reload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions pkgs/dartpad_ui/lib/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,37 @@ class RunButton extends ActionButton {
}

class ReloadButton extends ActionButton {
const ReloadButton({super.key, super.onPressed})
ReloadButton({super.key, super.onPressed})
: super(
text: 'Reload',
icon: const Icon(Icons.refresh, color: Colors.black, size: 20),
icon: ImageIcon(
AssetImage('assets/hot-reload.png'),
color: Colors.black,
),
tooltip:
'Apply changes with Hot Reload, which re-renders the modified'
' widgets without losing the state of the app, when possible.',
);
}

abstract class ActionButton extends StatelessWidget {
final VoidCallback? onPressed;
final String text;
final Icon icon;
final Widget icon;
final String? tooltip;

const ActionButton({
this.onPressed,
super.key,
required this.text,
required this.icon,
this.tooltip,
});

@override
Widget build(BuildContext context) {
return Tooltip(
message: text,
message: tooltip ?? text,
waitDuration: tooltipDelay,
child: TextButton(
style: ButtonStyle(
Expand Down
1 change: 1 addition & 0 deletions pkgs/dartpad_ui/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ flutter:
- assets/flutter_logo_192.png
- assets/gemini_sparkle_192.png
- assets/firebase_studio_192.png
- assets/hot-reload.png