import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:plant_app/constants.dart'; class HeaderWithSearchBox extends StatelessWidget { final Size size; const HeaderWithSearchBox({super.key, required this.size}); @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.only(bottom: kDefaultPadding * 2.5), height: size.height * 0.2, child: Stack( children: [ Container( padding: const EdgeInsets.only( left: kDefaultPadding, right: kDefaultPadding, bottom: 36 + kDefaultPadding, ), decoration: const BoxDecoration( color: kPrimaryColor, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(36), bottomRight: Radius.circular(36), ), ), height: size.height * 0.2 - 27, child: Row( children: [ Text( "Hi Uishopy!", style: Theme.of(context).textTheme.headlineSmall!.copyWith( color: Colors.white, fontWeight: FontWeight.bold, ), ), const Spacer(), Image.asset("assets/images/logo.png"), ], ), ), Positioned( bottom: 0, left: 0, right: 0, child: Container( alignment: Alignment.center, height: 54, margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding), padding: const EdgeInsets.symmetric(horizontal: kDefaultPadding), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( offset: const Offset(0, 10), blurRadius: 50, color: kPrimaryColor.withOpacity(0.23), ), ], ), child: Row( children: [ Expanded( child: TextField( onChanged: (value) {}, decoration: InputDecoration( hintText: "Search", hintStyle: TextStyle(color: kPrimaryColor.withOpacity(0.5)), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, ), // surffix isn't working properly with SVG // thats why we use row // suffixIcon: SvgPicture.asset("assets/icons/search.svg"), ), ), SvgPicture.asset("assets/icons/search.svg"), ], ), ), ) ], ), ); } }