import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Material App', theme: ThemeData.dark(), home: Home(), ); } } class Home extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Material App Bar'), ), body: Center( child: TextField( onTap: () => print('TextField onTap'), decoration: InputDecoration( suffixIcon: IconButton( icon: Icon(Icons.arrow_forward_ios), onPressed: () => print('suffixIcon pressed'))), ), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () {}, ), ); } }
TextField suffix iconButton onpressed also triggers ontap of TextField
10 min read