mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 10:17:47 +08:00
39 lines
863 B
Dart
39 lines
863 B
Dart
import 'package:apidash_design_system/apidash_design_system.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class LearnButton extends StatelessWidget {
|
|
const LearnButton({
|
|
super.key,
|
|
this.label,
|
|
this.icon,
|
|
this.url,
|
|
});
|
|
|
|
final String? label;
|
|
final IconData? icon;
|
|
final String? url;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var textLabel = label ?? 'Learn';
|
|
return SizedBox(
|
|
height: 24,
|
|
child: ADFilledButton(
|
|
icon: Icons.help,
|
|
iconSize: kButtonIconSizeSmall,
|
|
label: textLabel,
|
|
isTonal: true,
|
|
buttonStyle: ButtonStyle(
|
|
padding: WidgetStatePropertyAll(kP10),
|
|
),
|
|
onPressed: () {
|
|
if (url != null) {
|
|
launchUrl(Uri.parse(url!));
|
|
}
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|