Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8a3989c

Browse files
all changes made for add blog page
1 parent df5197e commit 8a3989c

File tree

4 files changed

+129
-5
lines changed

4 files changed

+129
-5
lines changed

‎lib/Blog/addBlog.dart

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:blogapp/CustumWidget/OverlayCard.dart';
12
import 'package:flutter/material.dart';
23
import 'package:image_picker/image_picker.dart';
34

@@ -31,11 +32,23 @@ class _AddBlogState extends State<AddBlog> {
3132
}),
3233
actions: <Widget>[
3334
FlatButton(
34-
onPressed: null,
35-
child: Text(
36-
"Preview",
37-
style: TextStyle(fontSize: 18, color: Colors.blue),
38-
))
35+
onPressed: () {
36+
if (_imageFile.path != null &&
37+
_globalkey.currentState.validate()) {
38+
showModalBottomSheet(
39+
context: context,
40+
builder: ((builder) => OverlayCard(
41+
imagefile: _imageFile,
42+
title: _title.text,
43+
)),
44+
);
45+
}
46+
},
47+
child: Text(
48+
"Preview",
49+
style: TextStyle(fontSize: 18, color: Colors.blue),
50+
),
51+
)
3952
],
4053
),
4154
body: Form(

‎lib/CustumWidget/OverlayCard.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import 'dart:io';
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:image_picker/image_picker.dart';
5+
6+
class OverlayCard extends StatelessWidget {
7+
const OverlayCard({Key key, this.imagefile, this.title}) : super(key: key);
8+
final PickedFile imagefile;
9+
final String title;
10+
11+
@override
12+
Widget build(BuildContext context) {
13+
return Container(
14+
height: 200,
15+
padding: EdgeInsets.all(5),
16+
width: MediaQuery.of(context).size.width,
17+
child: Stack(
18+
children: <Widget>[
19+
Container(
20+
height: MediaQuery.of(context).size.height,
21+
width: MediaQuery.of(context).size.width,
22+
decoration: BoxDecoration(
23+
image: DecorationImage(
24+
image: FileImage(
25+
File(imagefile.path),
26+
),
27+
fit: BoxFit.fitWidth),
28+
),
29+
),
30+
Positioned(
31+
bottom: 2,
32+
child: Container(
33+
padding: EdgeInsets.all(8),
34+
height: 55,
35+
width: MediaQuery.of(context).size.width,
36+
decoration: BoxDecoration(
37+
color: Colors.white, borderRadius: BorderRadius.circular(8)),
38+
child: Text(
39+
title,
40+
style: TextStyle(
41+
fontWeight: FontWeight.bold,
42+
fontSize: 15,
43+
),
44+
),
45+
),
46+
)
47+
],
48+
),
49+
);
50+
}
51+
}

‎lib/Model/addBlogModels.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
part 'addBlogModels.g.dart';
4+
5+
@JsonSerializable()
6+
class AddBlogModel {
7+
String coverImage;
8+
int count;
9+
int share;
10+
int comment;
11+
String id;
12+
String username;
13+
String title;
14+
String body;
15+
16+
AddBlogModel(
17+
{this.coverImage,
18+
this.count,
19+
this.share,
20+
this.comment,
21+
this.id,
22+
this.username,
23+
this.body,
24+
this.title});
25+
factory AddBlogModel.fromJson(Map<String, dynamic> json) =>
26+
_$AddBlogModelFromJson(json);
27+
Map<String, dynamic> toJson() => _$AddBlogModelToJson(this);
28+
}

‎lib/Model/addBlogModels.g.dart

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /