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 d1e5b08

Browse files
Add Blog Page Added
1 parent faf25d2 commit d1e5b08

File tree

1 file changed

+69
-70
lines changed

1 file changed

+69
-70
lines changed

‎lib/Blog/addBlog.dart

Lines changed: 69 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:flutter/material.dart';
2-
import 'package:image_picker/image_picker.dart';
32

43
class AddBlog extends StatefulWidget {
54
AddBlog({Key key}) : super(key: key);
@@ -9,108 +8,108 @@ class AddBlog extends StatefulWidget {
98
}
109

1110
class _AddBlogState extends State<AddBlog> {
12-
PickedFile _imageFile;
13-
final ImagePicker _picker = ImagePicker();
14-
IconData icon = Icons.image;
1511
@override
1612
Widget build(BuildContext context) {
1713
return Scaffold(
1814
appBar: AppBar(
19-
elevation: 0,
2015
backgroundColor: Colors.white54,
16+
elevation: 0,
2117
leading: IconButton(icon: Icon(Icons.clear), onPressed: null),
2218
actions: <Widget>[
23-
Padding(
24-
padding: const EdgeInsets.all(8.0),
25-
child: FlatButton(
26-
onPressed: null,
27-
child: Text(
28-
"Submit",
29-
style: TextStyle(color: Colors.teal, fontSize: 20),
30-
)),
31-
)
19+
FlatButton(
20+
onPressed: null,
21+
child: Text(
22+
"Preview",
23+
style: TextStyle(fontSize: 18, color: Colors.blue),
24+
))
3225
],
3326
),
34-
body: SingleChildScrollView(
35-
child: Column(
36-
children: <Widget>[
37-
textField(),
38-
textField2(),
39-
],
40-
),
27+
body: ListView(
28+
children: <Widget>[
29+
titleTextField(),
30+
bodyTextField(),
31+
SizedBox(
32+
height: 20,
33+
),
34+
addButton(),
35+
],
4136
),
4237
);
4338
}
4439

45-
Widget textField() {
40+
Widget titleTextField() {
4641
return Padding(
47-
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
42+
padding: const EdgeInsets.symmetric(
43+
horizontal: 10,
44+
vertical: 10,
45+
),
4846
child: TextFormField(
49-
// controller: _name,
50-
validator: (value) {
51-
if (value.isEmpty) return "Name can't be empty";
52-
53-
return null;
54-
},
55-
maxLength: 100,
56-
maxLines: null,
5747
decoration: InputDecoration(
58-
prefixIcon: IconButton(
59-
icon: Icon(
60-
icon,
61-
color: Colors.green,
62-
),
63-
onPressed: takePhoto),
6448
border: OutlineInputBorder(
65-
borderSide: BorderSide(
66-
color: Colors.teal,
67-
)),
49+
borderSide: BorderSide(
50+
color: Colors.teal,
51+
),
52+
),
6853
focusedBorder: OutlineInputBorder(
69-
borderSide: BorderSide(
70-
color: Colors.orange,
71-
width: 2,
72-
)),
73-
labelText: "Cover Image and Title",
54+
borderSide: BorderSide(
55+
color: Colors.orange,
56+
width: 2,
57+
),
58+
),
59+
labelText: "Add Image and Title",
60+
prefixIcon: IconButton(
61+
icon: Icon(
62+
Icons.image,
63+
color: Colors.teal,
64+
),
65+
onPressed: null,
66+
),
7467
),
68+
maxLength: 100,
69+
maxLines: null,
7570
),
7671
);
7772
}
7873

79-
Widget textField2() {
74+
Widget bodyTextField() {
8075
return Padding(
81-
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
76+
padding: const EdgeInsets.symmetric(
77+
horizontal: 10,
78+
),
8279
child: TextFormField(
83-
// controller: _name,
84-
validator: (value) {
85-
if (value.isEmpty) return "Name can't be empty";
86-
87-
return null;
88-
},
89-
// maxLength: 100,
90-
maxLines: null,
9180
decoration: InputDecoration(
9281
border: OutlineInputBorder(
93-
borderSide: BorderSide(
94-
color: Colors.teal,
95-
)),
82+
borderSide: BorderSide(
83+
color: Colors.teal,
84+
),
85+
),
9686
focusedBorder: OutlineInputBorder(
97-
borderSide: BorderSide(
98-
color: Colors.orange,
99-
width: 2,
100-
)),
101-
labelText: "body",
87+
borderSide: BorderSide(
88+
color: Colors.orange,
89+
width: 2,
90+
),
91+
),
92+
labelText: "Provide Body Your Blog",
10293
),
94+
maxLines: null,
10395
),
10496
);
10597
}
10698

107-
void takePhoto() async {
108-
final pickedFile = await _picker.getImage(
109-
source: ImageSource.gallery,
99+
Widget addButton() {
100+
return Center(
101+
child: Container(
102+
height: 50,
103+
width: 200,
104+
decoration: BoxDecoration(
105+
borderRadius: BorderRadius.circular(10), color: Colors.teal),
106+
child: Center(
107+
child: Text(
108+
"Add Blog",
109+
style: TextStyle(
110+
color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),
111+
)),
112+
),
110113
);
111-
setState(() {
112-
_imageFile = pickedFile;
113-
icon = Icons.check_box;
114-
});
115114
}
116115
}

0 commit comments

Comments
(0)

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