-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
153 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,69 @@ | ||
import 'package:badges/badges.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
import '../constants/colors.dart'; | ||
import '../providers/cart.dart'; | ||
|
||
class SearchBox extends StatelessWidget { | ||
const SearchBox({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return TextFormField( | ||
decoration: InputDecoration( | ||
contentPadding: const EdgeInsets.all(10), | ||
prefixIcon: Icon(Icons.search, color: greyLite), | ||
suffixIcon: ElevatedButton( | ||
style: ElevatedButton.styleFrom( | ||
primary: primaryColor, | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(10), | ||
Size size = MediaQuery.of(context).size; | ||
var cartData = Provider.of<CartData>(context, listen: false); | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
SizedBox( | ||
width: size.width / 1.22, | ||
child: TextFormField( | ||
decoration: InputDecoration( | ||
contentPadding: const EdgeInsets.all(10), | ||
prefixIcon: Icon(Icons.search, color: greyLite), | ||
suffixIcon: ElevatedButton( | ||
style: ElevatedButton.styleFrom( | ||
primary: primaryColor, | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(10), | ||
), | ||
), | ||
onPressed: () {}, | ||
child: const Text('Search'), | ||
), | ||
hintText: 'Type here...', | ||
focusedBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(12), | ||
borderSide: const BorderSide( | ||
width: 1, | ||
color: primaryColor, | ||
), | ||
), | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(12), | ||
borderSide: const BorderSide( | ||
width: 20, | ||
color: primaryColor, | ||
), | ||
), | ||
), | ||
), | ||
onPressed: () {}, | ||
child: const Text('Search'), | ||
), | ||
hintText: 'Type here...', | ||
focusedBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(12), | ||
borderSide: const BorderSide( | ||
width: 1, | ||
color: primaryColor, | ||
), | ||
), | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(12), | ||
borderSide: const BorderSide( | ||
width: 20, | ||
color: primaryColor, | ||
Consumer<CartData>(builder: (context, data, child)=> | ||
Badge( | ||
badgeContent: Text( | ||
cartData.cartItemCount.toString(), | ||
style: const TextStyle( | ||
color: primaryColor, | ||
), | ||
), | ||
child: const Icon( | ||
Icons.shopping_bag_outlined, | ||
size: 30, | ||
color: primaryColor, | ||
), | ||
), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters