Files
flutter_server_box/lib/view/widget/icon_text_btn.dart
2024-05-09 23:27:05 +08:00

40 lines
982 B
Dart

import 'package:flutter/material.dart';
import 'package:toolbox/data/res/ui.dart';
final class IconTextBtn extends StatelessWidget {
final String text;
final IconData icon;
final VoidCallback? onPressed;
final Orientation orientation;
const IconTextBtn({
super.key,
required this.text,
required this.icon,
this.onPressed,
this.orientation = Orientation.portrait,
});
@override
Widget build(BuildContext context) {
return IconButton(
onPressed: onPressed,
tooltip: text,
icon: orientation == Orientation.landscape
? Row(
children: [
Icon(icon),
UIs.width7,
Text(text, style: UIs.text13Grey),
],
)
: Column(
children: [
Icon(icon),
UIs.height7,
Text(text, style: UIs.text13Grey),
],
));
}
}