Skip to content

Commit 5a5baee

Browse files
committed
feat: implement headers of contest and search tab
1 parent f8f4af4 commit 5a5baee

5 files changed

Lines changed: 148 additions & 61 deletions

File tree

lib/data/constants/colors.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class AppColors {
77
static const Color grey3 = Color(0xFF242424);
88
static const Color grey4 = Color(0xFF2C363F);
99
static const Color grey5 = Color(0x3D000000);
10+
static const Color grey6 = Color(0xFF919191);
11+
static const Color grey7 = Color(0xFFF3F4F7);
1012
static const Color transparent = Colors.transparent;
1113

1214
static const Color primary = Color(0xFF3366FF);

lib/presentation/components/inputs/text_input.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class TextInput extends StatelessWidget {
1616
this.obscureText = false,
1717
this.onChanged,
1818
this.prefix,
19+
this.suffix,
20+
this.isFilled,
21+
this.fillColor,
1922
Key? key,
2023
}) : assert(
2124
controller != null || onChanged != null,
@@ -32,6 +35,9 @@ class TextInput extends StatelessWidget {
3235
final TextInputType? keyboard;
3336
final TextEditingController? controller;
3437
final Widget? prefix;
38+
final Widget? suffix;
39+
final bool? isFilled;
40+
final Color? fillColor;
3541

3642
@override
3743
Widget build(BuildContext context) {
@@ -41,6 +47,7 @@ class TextInput extends StatelessWidget {
4147
hintText: hint,
4248
hintStyle: AppStyles.h6,
4349
prefixIcon: prefix,
50+
suffixIcon: suffix,
4451
border: const OutlineInputBorder(
4552
borderSide: BorderSide(color: AppColors.primary),
4653
),
@@ -50,6 +57,8 @@ class TextInput extends StatelessWidget {
5057
width: 1.5,
5158
),
5259
),
60+
filled: isFilled,
61+
fillColor: fillColor,
5362
),
5463
initialValue: controller == null ? initialValue : null,
5564
keyboardType: keyboard,
Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,48 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_screenutil/flutter_screenutil.dart';
3+
import 'package:flutter_svg/svg.dart';
4+
5+
import '../../data/constants/assets.dart';
6+
import '../../data/constants/colors.dart';
27

38
class ContestsScreen extends StatelessWidget {
49
const ContestsScreen({Key? key}) : super(key: key);
510

611
@override
712
Widget build(BuildContext context) {
8-
return const Center(
9-
child: Text('Contest Screen'),
13+
return Column(
14+
children: [
15+
Container(
16+
height: 55.h,
17+
decoration: BoxDecoration(
18+
boxShadow: [
19+
BoxShadow(
20+
blurRadius: 2,
21+
color: AppColors.white.withOpacity(0.15),
22+
offset: const Offset(0, 1),
23+
),
24+
],
25+
),
26+
padding: EdgeInsets.symmetric(horizontal: 17.w),
27+
child: Row(
28+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
29+
children: [
30+
const Text(
31+
'Contest',
32+
style: TextStyle(
33+
fontSize: 22,
34+
fontWeight: FontWeight.w600,
35+
color: Colors.black,
36+
),
37+
),
38+
IconButton(
39+
onPressed: () {},
40+
icon: SvgPicture.asset(AppAssets.search),
41+
)
42+
],
43+
),
44+
),
45+
],
1046
);
1147
}
1248
}

lib/presentation/home/home_screen.dart

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,63 +13,65 @@ class HomeScreen extends StatelessWidget {
1313
Widget build(BuildContext context) {
1414
return BlocBuilder<HomeBloc, HomeState>(
1515
builder: (context, state) {
16-
return Scaffold(
17-
body: state.screen,
18-
bottomNavigationBar: Container(
19-
decoration: const BoxDecoration(
20-
color: AppColors.white,
21-
boxShadow: [
22-
BoxShadow(
23-
blurRadius: 16,
24-
color: Color.fromRGBO(193, 193, 193, 0.5),
25-
offset: Offset(0, -4),
26-
),
27-
],
28-
),
29-
child: Row(
30-
mainAxisAlignment: MainAxisAlignment.spaceAround,
31-
children: [
32-
NavBarItem(
33-
label: 'Feed',
34-
isActive: state.selectedIndex == 0,
35-
callback: () {
36-
context
37-
.read<HomeBloc>()
38-
.add(const BottomNavItemPressed(index: 0));
39-
},
40-
icon: AppAssets.feed,
41-
),
42-
NavBarItem(
43-
label: 'Contests',
44-
isActive: state.selectedIndex == 1,
45-
callback: () {
46-
context
47-
.read<HomeBloc>()
48-
.add(const BottomNavItemPressed(index: 1));
49-
},
50-
icon: AppAssets.contest,
51-
),
52-
NavBarItem(
53-
label: 'Search',
54-
isActive: state.selectedIndex == 2,
55-
callback: () {
56-
context
57-
.read<HomeBloc>()
58-
.add(const BottomNavItemPressed(index: 2));
59-
},
60-
icon: AppAssets.search,
61-
),
62-
NavBarItem(
63-
label: 'Profile',
64-
isActive: state.selectedIndex == 3,
65-
callback: () {
66-
context
67-
.read<HomeBloc>()
68-
.add(const BottomNavItemPressed(index: 3));
69-
},
70-
icon: AppAssets.profile,
71-
),
72-
],
16+
return SafeArea(
17+
child: Scaffold(
18+
body: state.screen,
19+
bottomNavigationBar: Container(
20+
decoration: const BoxDecoration(
21+
color: AppColors.white,
22+
boxShadow: [
23+
BoxShadow(
24+
blurRadius: 16,
25+
color: Color.fromRGBO(193, 193, 193, 0.5),
26+
offset: Offset(0, -4),
27+
),
28+
],
29+
),
30+
child: Row(
31+
mainAxisAlignment: MainAxisAlignment.spaceAround,
32+
children: [
33+
NavBarItem(
34+
label: 'Feed',
35+
isActive: state.selectedIndex == 0,
36+
callback: () {
37+
context
38+
.read<HomeBloc>()
39+
.add(const BottomNavItemPressed(index: 0));
40+
},
41+
icon: AppAssets.feed,
42+
),
43+
NavBarItem(
44+
label: 'Contests',
45+
isActive: state.selectedIndex == 1,
46+
callback: () {
47+
context
48+
.read<HomeBloc>()
49+
.add(const BottomNavItemPressed(index: 1));
50+
},
51+
icon: AppAssets.contest,
52+
),
53+
NavBarItem(
54+
label: 'Search',
55+
isActive: state.selectedIndex == 2,
56+
callback: () {
57+
context
58+
.read<HomeBloc>()
59+
.add(const BottomNavItemPressed(index: 2));
60+
},
61+
icon: AppAssets.search,
62+
),
63+
NavBarItem(
64+
label: 'Profile',
65+
isActive: state.selectedIndex == 3,
66+
callback: () {
67+
context
68+
.read<HomeBloc>()
69+
.add(const BottomNavItemPressed(index: 3));
70+
},
71+
icon: AppAssets.profile,
72+
),
73+
],
74+
),
7375
),
7476
),
7577
);
Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_screenutil/flutter_screenutil.dart';
3+
4+
import '../../data/constants/colors.dart';
5+
import '../components/inputs/text_input.dart';
26

37
class SearchScreen extends StatelessWidget {
48
const SearchScreen({Key? key}) : super(key: key);
59

610
@override
711
Widget build(BuildContext context) {
8-
return const Center(
9-
child: Text('Search Screen'),
12+
return Column(
13+
children: [
14+
Padding(
15+
padding: EdgeInsets.symmetric(
16+
horizontal: 13.w,
17+
vertical: 30.h,
18+
),
19+
child: TextInput(
20+
hint: 'Search people by name or handles',
21+
onChanged: (val) {},
22+
isFilled: true,
23+
fillColor: AppColors.grey7,
24+
suffix: Row(
25+
mainAxisSize: MainAxisSize.min,
26+
children: [
27+
IconButton(
28+
padding: const EdgeInsets.fromLTRB(4, 1, 1, 4),
29+
icon: const Icon(
30+
Icons.filter_alt,
31+
color: AppColors.grey6,
32+
),
33+
onPressed: () {},
34+
),
35+
IconButton(
36+
padding: const EdgeInsets.fromLTRB(4, 1, 1, 4),
37+
icon: const Icon(
38+
Icons.clear,
39+
color: AppColors.grey6,
40+
),
41+
onPressed: () {},
42+
),
43+
],
44+
),
45+
),
46+
),
47+
],
1048
);
1149
}
1250
}

0 commit comments

Comments
 (0)