Please check the implementation i have written a sample code, make changes as per your requirement.
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: MyApp()));
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: const Text('Search field example'),
),
body: Container(
width: 300,
height: 50,
margin: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Colors.black12,
blurRadius: 2.0,
spreadRadius: 0.0,
offset: Offset(2.0, 2.0), // shadow direction: bottom right
)
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Icon(
Icons.search_sharp,
color: Colors.redAccent,
),
),
const Expanded(
child: TextField(
decoration: InputDecoration(
hintText: 'Search',
border: OutlineInputBorder(
borderSide: BorderSide.none,
),
),
),
),
Container(
width: 1,
height: 30,
color: Colors.grey[350],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: GestureDetector(
onTap: () {
// function for mic tap implementation
},
child: const Icon(
Icons.mic_none_outlined,
color: Colors.redAccent,
),
),
)
],
),
),
),
);
}
}
