mirror of
https://github.com/haorendashu/nowser.git
synced 2025-12-17 09:54:19 +01:00
44 lines
849 B
Dart
44 lines
849 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class WebControlBtnComponent extends StatefulWidget {
|
|
String name;
|
|
|
|
Widget icon;
|
|
|
|
Function? onTap;
|
|
|
|
WebControlBtnComponent({
|
|
required this.name,
|
|
required this.icon,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
return _WebControlBtnComponent();
|
|
}
|
|
}
|
|
|
|
class _WebControlBtnComponent extends State<WebControlBtnComponent> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
if (widget.onTap != null) {
|
|
widget.onTap!();
|
|
}
|
|
},
|
|
behavior: HitTestBehavior.translucent,
|
|
child: Container(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
widget.icon,
|
|
Text(widget.name),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|