2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class TextFieldIconButton extends StatefulWidget {
|
|
|
|
const TextFieldIconButton({
|
|
|
|
Key? key,
|
|
|
|
this.width = 40,
|
|
|
|
this.height = 40,
|
|
|
|
this.onTap,
|
|
|
|
required this.child,
|
|
|
|
this.color = Colors.transparent,
|
2023-04-28 18:21:30 +00:00
|
|
|
this.semanticsLabel = "Button",
|
2022-08-26 08:11:35 +00:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final double width;
|
|
|
|
final double height;
|
|
|
|
final VoidCallback? onTap;
|
|
|
|
final Widget child;
|
|
|
|
final Color color;
|
2023-04-28 18:21:30 +00:00
|
|
|
final String semanticsLabel;
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<TextFieldIconButton> createState() => _TextFieldIconButtonState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _TextFieldIconButtonState extends State<TextFieldIconButton> {
|
|
|
|
late final VoidCallback? onTap;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
onTap = widget.onTap;
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SizedBox(
|
|
|
|
height: widget.height,
|
|
|
|
width: widget.width,
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(100),
|
2023-04-27 18:14:04 +00:00
|
|
|
child: Semantics(
|
2023-04-28 18:21:30 +00:00
|
|
|
label: widget.semanticsLabel,
|
2023-04-27 18:14:04 +00:00
|
|
|
excludeSemantics: true,
|
|
|
|
child: RawMaterialButton(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minWidth: widget.width,
|
|
|
|
minHeight: widget.height,
|
|
|
|
),
|
|
|
|
onPressed: onTap,
|
|
|
|
child: Container(
|
|
|
|
width: widget.width,
|
|
|
|
height: widget.height,
|
|
|
|
color: widget.color,
|
|
|
|
child: Center(
|
|
|
|
child: widget.child,
|
|
|
|
),
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
),
|
2023-04-27 18:14:04 +00:00
|
|
|
)
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|