Skip to content

Commit c0fc449

Browse files
committed
blog page work started
1 parent ca305df commit c0fc449

File tree

6 files changed

+65
-11
lines changed

6 files changed

+65
-11
lines changed

lib/Blog/Blog.dart

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,56 @@
1+
import 'package:blogapp/Model/addBlogModels.dart';
2+
import 'package:blogapp/NetworkHandler.dart';
13
import 'package:flutter/material.dart';
24

35
class Blog extends StatelessWidget {
4-
const Blog({Key key}) : super(key: key);
5-
6+
const Blog({Key key, this.addBlogModel, this.networkHandler})
7+
: super(key: key);
8+
final AddBlogModel addBlogModel;
9+
final NetworkHandler networkHandler;
610
@override
711
Widget build(BuildContext context) {
8-
return Scaffold();
12+
return Scaffold(
13+
// backgroundColor: Colors.black,
14+
body: ListView(
15+
children: [
16+
Container(
17+
height: 310,
18+
width: MediaQuery.of(context).size.width,
19+
child: Card(
20+
// margin: EdgeInsets.all(0),
21+
elevation: 8,
22+
child: Column(
23+
children: [
24+
Container(
25+
height: 230,
26+
width: MediaQuery.of(context).size.width,
27+
decoration: BoxDecoration(
28+
color: Colors.black,
29+
image: DecorationImage(
30+
image: networkHandler.getImage(addBlogModel.id),
31+
fit: BoxFit.fill,
32+
),
33+
),
34+
),
35+
// SizedBox()
36+
Container(
37+
padding: const EdgeInsets.symmetric(
38+
horizontal: 20, vertical: 10),
39+
child: Text(
40+
addBlogModel.title,
41+
textAlign: TextAlign.center,
42+
style: TextStyle(
43+
fontSize: 16,
44+
fontWeight: FontWeight.bold,
45+
),
46+
),
47+
),
48+
],
49+
),
50+
),
51+
),
52+
],
53+
),
54+
);
955
}
1056
}

lib/Blog/Blogs.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,21 @@ class _BlogsState extends State<Blogs> {
4242
children: <Widget>[
4343
InkWell(
4444
onTap: () {
45-
Navigator.push(context,
46-
MaterialPageRoute(builder: (contex) => Blog()));
45+
Navigator.push(
46+
context,
47+
MaterialPageRoute(
48+
builder: (contex) => Blog(
49+
addBlogModel: item,
50+
networkHandler: networkHandler,
51+
)));
4752
},
4853
child: BlogCard(
4954
addBlogModel: item,
5055
networkHandler: networkHandler,
5156
),
5257
),
5358
SizedBox(
54-
height: 10,
59+
height: 0,
5560
),
5661
],
5762
))

lib/CustumWidget/BlogCard.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class BlogCard extends StatelessWidget {
1515
@override
1616
Widget build(BuildContext context) {
1717
return Container(
18-
height: 300,
19-
padding: EdgeInsets.all(15),
18+
height: 280,
19+
padding: EdgeInsets.symmetric(horizontal: 13, vertical: 8),
2020
width: MediaQuery.of(context).size.width,
2121
child: Card(
2222
child: Stack(
@@ -27,15 +27,15 @@ class BlogCard extends StatelessWidget {
2727
decoration: BoxDecoration(
2828
image: DecorationImage(
2929
image: networkHandler.getImage(addBlogModel.id),
30-
fit: BoxFit.fitWidth),
30+
fit: BoxFit.fill),
3131
),
3232
),
3333
Positioned(
3434
bottom: 2,
3535
child: Container(
36-
padding: EdgeInsets.all(8),
36+
padding: EdgeInsets.all(7),
3737
height: 60,
38-
width: MediaQuery.of(context).size.width,
38+
width: MediaQuery.of(context).size.width - 30,
3939
decoration: BoxDecoration(
4040
color: Colors.white,
4141
borderRadius: BorderRadius.circular(8)),

lib/Profile/MainProfile.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class _MainProfileState extends State<MainProfile> {
3232
@override
3333
Widget build(BuildContext context) {
3434
return Scaffold(
35+
backgroundColor: Color(0xffEEEEFF),
3536
appBar: AppBar(
3637
elevation: 0,
3738
backgroundColor: Colors.white10,

lib/Profile/ProfileScreen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
3737
@override
3838
Widget build(BuildContext context) {
3939
return Scaffold(
40+
backgroundColor: Color(0xffEEEEFF),
4041
body: page,
4142
);
4243
}

lib/Screen/HomeScreen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class _HomeScreenState extends State<HomeScreen> {
1212
@override
1313
Widget build(BuildContext context) {
1414
return Scaffold(
15+
backgroundColor: Color(0xffEEEEFF),
1516
body: SingleChildScrollView(
1617
child: Blogs(
1718
url: "/blogpost/getOtherBlog",

0 commit comments

Comments
 (0)