gpt4 book ai didi

user-interface - 如何调整 TextField 的后缀/suffixIcon 高度?

转载 作者:行者123 更新时间:2023-12-05 08:20:15 26 4
gpt4 key购买 nike

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SafeArea(
child: Scaffold(
body: Column(
children: [
Container(
color: Colors.orange,
child: TextField(
decoration: InputDecoration(
suffix: IconButton(
icon: Icon(Icons.check_circle),
onPressed: () {
print('222');
}),
),
),
),
],
),
),
),
);
}
}

如何强制 check_circle 图标自动调整大小以匹配实际 TextField 的高度,即,根据其光标高度?

最佳答案

改用suffixIcon

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SafeArea(
child: Scaffold(
body: Column(
children: [
Container(
color: Colors.orange,
child: TextField(
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(Icons.check_circle),
onPressed: () {
print('222');
}),
),
),
),
],
),
),
),
);
}
}

关于user-interface - 如何调整 TextField 的后缀/suffixIcon 高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56589170/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com