Skip to content

Commit f363558

Browse files
committed
blogging screens added with card types one and two
1 parent 3b77956 commit f363558

10 files changed

+549
-1
lines changed

lib/blog/blog.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'dart:ui';
2+
3+
class Blog {
4+
final String title;
5+
final String description;
6+
final Color bgColor;
7+
final String user;
8+
final String time;
9+
10+
const Blog(
11+
{this.title, this.description, this.bgColor, this.user, this.time});
12+
}

lib/blog/blog_card_type_one.dart

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import 'package:contraflutterkit/custom_widgets/button_plain_with_shadow.dart';
2+
import 'package:contraflutterkit/utils/colors.dart';
3+
import 'package:flutter/cupertino.dart';
4+
import 'package:flutter/material.dart';
5+
6+
import 'blog.dart';
7+
8+
class BlogCardTypeOne extends StatelessWidget {
9+
final VoidCallback onTap;
10+
final Blog blog;
11+
12+
const BlogCardTypeOne({this.onTap, this.blog});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return GestureDetector(
17+
onTap: onTap,
18+
child: Container(
19+
margin: EdgeInsets.only(top: 24),
20+
padding: EdgeInsets.all(24),
21+
decoration: ShapeDecoration(
22+
color: blog.bgColor,
23+
shadows: [
24+
BoxShadow(
25+
color: wood_smoke,
26+
offset: Offset(
27+
0.0, // Move to right 10 horizontally
28+
4.0, // Move to bottom 5 Vertically
29+
),
30+
)
31+
],
32+
shape: RoundedRectangleBorder(
33+
borderRadius: BorderRadius.all(Radius.circular(16)),
34+
side: BorderSide(color: wood_smoke, width: 2))),
35+
child: Column(
36+
crossAxisAlignment: CrossAxisAlignment.start,
37+
children: <Widget>[
38+
Image.asset(
39+
"assets/images/peep_avatar.png",
40+
width: 48,
41+
height: 48,
42+
),
43+
SizedBox(
44+
height: 24,
45+
),
46+
Text(
47+
"Work with us and forget about others",
48+
style: TextStyle(
49+
fontSize: 36,
50+
fontWeight: FontWeight.bold,
51+
color: wood_smoke),
52+
),
53+
SizedBox(
54+
height: 48,
55+
),
56+
Row(
57+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
58+
children: <Widget>[
59+
Column(
60+
children: <Widget>[
61+
Text(
62+
"Alisa Red",
63+
style: TextStyle(
64+
fontSize: 17,
65+
fontWeight: FontWeight.bold,
66+
color: wood_smoke),
67+
),
68+
Text(
69+
"33 March, 20",
70+
style: TextStyle(
71+
fontSize: 13,
72+
fontWeight: FontWeight.normal,
73+
color: wood_smoke),
74+
)
75+
],
76+
),
77+
ButtonPlainWithShadow(
78+
borderColor: wood_smoke,
79+
color: lightening_yellow,
80+
text: "Follow",
81+
callback: () {},
82+
shadowColor: wood_smoke,
83+
),
84+
],
85+
)
86+
],
87+
),
88+
));
89+
}
90+
}

lib/blog/blog_card_type_two.dart

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import 'package:contraflutterkit/utils/colors.dart';
2+
import 'package:flutter/cupertino.dart';
3+
import 'package:flutter/material.dart';
4+
5+
import 'blog.dart';
6+
7+
class BlogCardTypeTwo extends StatelessWidget {
8+
final VoidCallback onTap;
9+
final Blog blog;
10+
11+
const BlogCardTypeTwo({this.onTap, this.blog});
12+
13+
@override
14+
Widget build(BuildContext context) {
15+
return GestureDetector(
16+
onTap: onTap,
17+
child: Container(
18+
margin: EdgeInsets.only(top: 24),
19+
padding: EdgeInsets.all(24),
20+
decoration: ShapeDecoration(
21+
color: blog.bgColor,
22+
shadows: [
23+
BoxShadow(
24+
color: wood_smoke,
25+
offset: Offset(
26+
0.0, // Move to right 10 horizontally
27+
4.0, // Move to bottom 5 Vertically
28+
),
29+
)
30+
],
31+
shape: RoundedRectangleBorder(
32+
borderRadius: BorderRadius.all(Radius.circular(16)),
33+
side: BorderSide(color: wood_smoke, width: 2))),
34+
child: Column(
35+
crossAxisAlignment: CrossAxisAlignment.start,
36+
children: <Widget>[
37+
Text(
38+
"by Lara Trina • 12 March, 20",
39+
style: TextStyle(
40+
fontSize: 12, fontWeight: FontWeight.bold, color: trout),
41+
),
42+
SizedBox(
43+
height: 24,
44+
),
45+
Text(
46+
"I’m post title, Please keep it 2 line onely...",
47+
style: TextStyle(
48+
fontSize: 24,
49+
fontWeight: FontWeight.w800,
50+
color: wood_smoke),
51+
),
52+
],
53+
),
54+
));
55+
}
56+
}

lib/blog/blog_home_page.dart

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import 'package:contraflutterkit/shopping/shopping_home_page_one.dart';
2+
import 'package:contraflutterkit/shopping/shopping_home_page_two.dart';
3+
import 'package:contraflutterkit/utils/colors.dart';
4+
import 'package:flutter/material.dart';
5+
6+
class BlogHomePage extends StatefulWidget {
7+
@override
8+
_BlogHomePageState createState() => _BlogHomePageState();
9+
}
10+
11+
class _BlogHomePageState extends State<BlogHomePage> {
12+
int _currentIndex = 0;
13+
final List<Widget> _childrenWidgets = [
14+
ShoppingHomePageTwo(),
15+
ShoppingHomePageOne(),
16+
ShoppingHomePageTwo(),
17+
ShoppingHomePageOne(),
18+
];
19+
20+
void _onItemTapped(int index) {
21+
setState(() {
22+
_currentIndex = index;
23+
});
24+
}
25+
26+
@override
27+
Widget build(BuildContext context) {
28+
return Scaffold(
29+
body: Center(
30+
child: _childrenWidgets.elementAt(_currentIndex),
31+
),
32+
bottomNavigationBar: BottomNavigationBar(
33+
items: [
34+
BottomNavigationBarItem(icon: Icon(Icons.home), title: Text("Home")),
35+
BottomNavigationBarItem(
36+
icon: Icon(Icons.search), title: Text("Search")),
37+
BottomNavigationBarItem(
38+
icon: Icon(Icons.chat_bubble), title: Text("Chat")),
39+
BottomNavigationBarItem(icon: Icon(Icons.info), title: Text("About")),
40+
],
41+
currentIndex: _currentIndex,
42+
onTap: _onItemTapped,
43+
selectedItemColor: wood_smoke,
44+
unselectedItemColor: trout,
45+
showSelectedLabels: true,
46+
showUnselectedLabels: true,
47+
selectedIconTheme: IconThemeData(color: wood_smoke, opacity: 1),
48+
unselectedIconTheme: IconThemeData(color: trout, opacity: 0.6),
49+
selectedLabelStyle: TextStyle(
50+
color: wood_smoke, fontSize: 12, fontWeight: FontWeight.w800),
51+
unselectedLabelStyle:
52+
TextStyle(color: trout, fontSize: 12, fontWeight: FontWeight.w800),
53+
),
54+
);
55+
}
56+
}

lib/blog/blog_list_page_one.dart

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import 'package:contraflutterkit/blog/blog_card_type_one.dart';
2+
import 'package:contraflutterkit/custom_widgets/custom_app_bar.dart';
3+
import 'package:contraflutterkit/login/login_text.dart';
4+
import 'package:contraflutterkit/utils/colors.dart';
5+
import 'package:flutter/cupertino.dart';
6+
import 'package:flutter/material.dart';
7+
8+
import 'blog.dart';
9+
10+
class BlogListPageOne extends StatefulWidget {
11+
@override
12+
_BlogListPageOneState createState() => _BlogListPageOneState();
13+
}
14+
15+
class _BlogListPageOneState extends State<BlogListPageOne> {
16+
List<Blog> _blogs = List<Blog>();
17+
18+
@override
19+
void initState() {
20+
super.initState();
21+
_blogs.add(Blog(
22+
bgColor: foam,
23+
time: "25 April, 20",
24+
title: "Work with us and forget about others",
25+
user: "Alisa Red",
26+
description:
27+
"Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea."));
28+
_blogs.add(Blog(
29+
bgColor: lavandar_bush,
30+
time: "1 Jan, 20",
31+
title: "Work with us and forget about others",
32+
user: "Riya Red",
33+
description:
34+
"Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea."));
35+
_blogs.add(Blog(
36+
bgColor: fair_pink,
37+
time: "30 March, 20",
38+
title: "Work with us and forget about others",
39+
user: "Con Red",
40+
description:
41+
"Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea."));
42+
_blogs.add(Blog(
43+
bgColor: athen_gray,
44+
time: "12 Dec, 20",
45+
title: "Work with us and forget about others",
46+
user: "Melyssa Chen",
47+
description:
48+
"Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea. Wireframe is still important for ideation. It will help you to quickly test idea."));
49+
}
50+
51+
@override
52+
Widget build(BuildContext context) {
53+
return Scaffold(
54+
appBar: CustomAppBar(
55+
height: 150,
56+
child: Column(
57+
mainAxisAlignment: MainAxisAlignment.end,
58+
children: [
59+
Padding(
60+
padding: const EdgeInsets.all(24.0),
61+
child: Row(
62+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
63+
children: <Widget>[
64+
Expanded(
65+
flex: 2,
66+
child: LoginText(
67+
size: 44,
68+
alignment: Alignment.bottomCenter,
69+
text: "Shop Yay",
70+
),
71+
),
72+
Expanded(
73+
flex: 1,
74+
child: Align(
75+
alignment: Alignment.centerRight,
76+
child: SizedBox(),
77+
),
78+
)
79+
],
80+
),
81+
),
82+
],
83+
),
84+
),
85+
body: ListView.builder(
86+
itemCount: _blogs.length,
87+
padding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
88+
itemBuilder: (BuildContext context, int index) {
89+
return BlogCardTypeOne(
90+
blog: _blogs[index],
91+
onTap: () {
92+
Navigator.pushNamed(context, "/shopping_detail_page_two");
93+
},
94+
);
95+
}),
96+
);
97+
}
98+
}

0 commit comments

Comments
 (0)