mirror of
https://github.com/foss42/apidash.git
synced 2025-05-22 08:46:33 +08:00
fix: review changes
This commit is contained in:
43
lib/widgets/button_repo.dart
Normal file
43
lib/widgets/button_repo.dart
Normal file
@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:apidash/consts.dart';
|
||||
|
||||
class RepoButton extends StatelessWidget {
|
||||
const RepoButton({
|
||||
super.key,
|
||||
this.text,
|
||||
this.icon,
|
||||
});
|
||||
|
||||
final String? text;
|
||||
final IconData? icon;
|
||||
|
||||
@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(
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kGitUrl));
|
||||
},
|
||||
icon: Icon(
|
||||
icon,
|
||||
size: 20.0,
|
||||
),
|
||||
label: Text(
|
||||
label,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user