Skip to content

Commit 1038f39

Browse files
committed
Final Center Circle Drawer.
1 parent 076e75d commit 1038f39

File tree

6 files changed

+344
-82
lines changed

6 files changed

+344
-82
lines changed

lib/generated/i18n.dart

+11-10
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ class S implements WidgetsLocalizations {
1212
const S();
1313

1414
static const GeneratedLocalizationsDelegate delegate =
15-
GeneratedLocalizationsDelegate();
15+
GeneratedLocalizationsDelegate();
1616

1717
static S of(BuildContext context) => Localizations.of<S>(context, S);
1818

1919
@override
2020
TextDirection get textDirection => TextDirection.ltr;
21+
2122
}
2223

23-
class en extends S {
24-
const en();
24+
class $en extends S {
25+
const $en();
2526
}
2627

2728
class GeneratedLocalizationsDelegate extends LocalizationsDelegate<S> {
@@ -71,24 +72,24 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate<S> {
7172
if (lang != null) {
7273
switch (lang) {
7374
case "en":
74-
return SynchronousFuture<S>(const en());
75+
return SynchronousFuture<S>(const $en());
7576
default:
76-
// NO-OP.
77+
// NO-OP.
7778
}
7879
}
7980
return SynchronousFuture<S>(const S());
8081
}
8182

8283
@override
8384
bool isSupported(Locale locale) =>
84-
locale != null && supportedLocales.contains(locale);
85+
locale != null && supportedLocales.contains(locale);
8586

8687
@override
8788
bool shouldReload(GeneratedLocalizationsDelegate old) => false;
8889
}
8990

9091
String getLang(Locale l) => l == null
91-
? null
92-
: l.countryCode != null && l.countryCode.isEmpty
93-
? l.languageCode
94-
: l.toString();
92+
? null
93+
: l.countryCode != null && l.countryCode.isEmpty
94+
? l.languageCode
95+
: l.toString();

lib/src/app2.dart

+91-65
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import 'package:flutter/material.dart';
2+
import 'package:hawalnir1/src/pages/listView.dart';
3+
import 'package:hawalnir1/src/widgets/animated_fab.dart';
24
import 'package:hawalnir1/src/widgets/eachPost.dart';
35
import 'package:http/http.dart' as http;
46
import 'widgets/drawerMain.dart';
@@ -14,17 +16,90 @@ WordpressClient client = new WordpressClient(_baseUrl, http.Client());
1416
final String _baseUrl = 'http://ehawal.com/index.php/wp-json';
1517

1618
var dbHelper = DatabaseHelper();
17-
int perPageInt = int.parse(perPage);
1819

1920
class HawalnirHome2 extends StatefulWidget {
2021
@override
2122
State<StatefulWidget> createState() => HawalnirHome2State();
2223
}
2324

24-
class HawalnirHome2State extends State {
25+
class HawalnirHome2State extends State<HawalnirHome2>
26+
with TickerProviderStateMixin {
27+
var scrollCont =
28+
ScrollController(initialScrollOffset: 0.0, keepScrollOffset: true);
29+
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
30+
2531
@override
2632
Widget build(BuildContext context) {
2733
return Scaffold(
34+
key: _scaffoldKey,
35+
// drawer: drawerMain(context),
36+
endDrawer: drawerMain(context),
37+
bottomNavigationBar: SizedBox(
38+
height: 60,
39+
child: BottomAppBar(
40+
41+
color: Colors.deepPurple,
42+
notchMargin: 3.0,
43+
shape: CircularNotchedRectangle(),
44+
child: ButtonBar(
45+
mainAxisSize: MainAxisSize.max,
46+
alignment: MainAxisAlignment.spaceEvenly,
47+
children: <Widget>[
48+
IconButton(
49+
padding: EdgeInsets.only(bottom: 10.0),
50+
icon: Icon(Icons.save),
51+
splashColor: Colors.blueAccent[200],
52+
color: Colors.blueGrey,
53+
tooltip: 'پاشكه‌وت كردنی بابه‌ت',
54+
onPressed: () {
55+
Navigator.pushNamed(context, '/InstaPage');
56+
},
57+
),
58+
IconButton(
59+
padding: EdgeInsets.only(bottom: 10.0),
60+
icon: Icon(Icons.favorite),
61+
splashColor: Colors.redAccent,
62+
color: Colors.blueGrey,
63+
tooltip: 'په‌سه‌ند كردن',
64+
onPressed: () {}, // add +1 to the database
65+
),
66+
Divider(),
67+
Divider(),
68+
IconButton(
69+
padding: EdgeInsets.only(bottom: 10.0),
70+
71+
icon: Icon(Icons.share),
72+
color: Colors.blueGrey,
73+
tooltip: 'بو هاورێكانت بنێره‌',
74+
onPressed:
75+
() {}, // Standard share for whatsapp + google + faccebook + twitter
76+
),
77+
IconButton(
78+
padding: EdgeInsets.only(bottom: 10.0),
79+
80+
icon: Icon(Icons.share),
81+
color: Colors.blueGrey,
82+
tooltip: 'بو هاورێكانت بنێره‌',
83+
onPressed:
84+
() {}, // Standard share for whatsapp + google + faccebook + twitter
85+
),
86+
],
87+
),
88+
),
89+
),
90+
floatingActionButton: FloatingActionButton(
91+
isExtended: false,
92+
elevation: 10.0,
93+
shape: CircleBorder(),
94+
child: Icon(Icons.menu),
95+
backgroundColor: Colors.deepPurple,
96+
onPressed: () {
97+
debugPrint("Drawer opened");
98+
99+
_scaffoldKey.currentState.openEndDrawer();
100+
}),
101+
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
102+
resizeToAvoidBottomPadding: true,
28103
body: OfflineBuilder(
29104
debounceDuration: Duration(seconds: 3),
30105
connectivityBuilder: (
@@ -36,31 +111,28 @@ class HawalnirHome2State extends State {
36111
return new Stack(
37112
fit: StackFit.expand,
38113
children: [
114+
FutureBuilder<List<Post>>(
115+
future: isExitst(),
116+
builder: (context, snapshot) {
117+
if (snapshot.hasError) print(snapshot.error);
39118

40-
RefreshIndicator(
41-
onRefresh: isExitst,
42-
child: FutureBuilder<List<Post>>(
43-
future: isExitst(),
44-
builder: (context, snapshot) {
45-
if (snapshot.hasError) print(snapshot.error);
46-
47-
return snapshot.hasData
48-
? ListViewPosts2(posts: snapshot.data)
49-
: Center(child: CircularProgressIndicator());
50-
},
51-
),
119+
return snapshot.hasData
120+
? ListViewPosts(posts: snapshot.data)
121+
: Center(child: CircularProgressIndicator());
122+
},
52123
),
53124
Positioned(
54125
height: 24.0,
55126
left: 0.0,
56127
right: 0.0,
57128
bottom: 0.0,
58-
59129
child: Container(
60-
color: connected ? Color(0xFF00EE44) : Color(0xFFEE4400),
61-
child: Center(
62-
child: Text("${connected ? 'ONLINE' : 'OFFLINE'}"),
63-
),
130+
color:
131+
connected ? null : Color(0xFFEE4400),
132+
child: Padding(
133+
padding: EdgeInsets.all(5.0),
134+
child: Text("${connected ? '' : 'OFFLINE'}",
135+
textDirection: TextDirection.rtl)),
64136
),
65137
),
66138
],
@@ -80,47 +152,6 @@ class HawalnirHome2State extends State {
80152
}
81153
}
82154

83-
class ListViewPosts2 extends StatefulWidget {
84-
final List<Post> posts;
85-
86-
ListViewPosts2({Key key, this.posts}) : super(key: key);
87-
88-
@override
89-
ListViewPosts2State createState() {
90-
return new ListViewPosts2State();
91-
}
92-
}
93-
94-
var scrollCont =
95-
ScrollController(initialScrollOffset: 0.0, keepScrollOffset: true);
96-
97-
class ListViewPosts2State extends State<ListViewPosts2> {
98-
var dbHelper = DatabaseHelper();
99-
List<Post> postList;
100-
int count = 0;
101-
102-
@override
103-
Widget build(BuildContext context) {
104-
getPostsIDs();
105-
return Directionality(
106-
textDirection: TextDirection.rtl, // RTL
107-
108-
child: Scaffold(
109-
body: Stack(
110-
children: <Widget>[
111-
CustomScrollView(
112-
slivers: <Widget>[
113-
sliverAppBarGlobal(),
114-
sliverListGlobal(),
115-
],
116-
),
117-
],
118-
),
119-
),
120-
);
121-
}
122-
}
123-
124155
// return OfflineBuilder(
125156
// debounceDuration: Duration(seconds: 3),
126157
// connectivityBuilder: (
@@ -217,11 +248,6 @@ class ListViewPosts2State extends State<ListViewPosts2> {
217248
// ),
218249
// );
219250

220-
void _scrollToTop() {
221-
scrollCont.animateTo(0.0,
222-
duration: Duration(seconds: 1), curve: Curves.elasticInOut);
223-
}
224-
225251
// child: CustomScrollView(
226252
// slivers: <Widget>[
227253
// SliverAppBar(

lib/src/pages/listView.dart

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:hawalnir1/src/blocs/database_helper.dart';
5+
import 'package:hawalnir1/src/blocs/functions.dart';
6+
import 'package:hawalnir1/src/widgets/catWidgets.dart';
7+
import 'package:hawalnir1/wordpress_client.dart';
8+
9+
class ListViewPosts extends StatefulWidget {
10+
final List<Post> posts;
11+
12+
ListViewPosts({Key key, this.posts}) : super(key: key);
13+
14+
@override
15+
ListViewPostsState createState() {
16+
return new ListViewPostsState();
17+
}
18+
}
19+
20+
var scrollCont =
21+
ScrollController(initialScrollOffset: 0.0, keepScrollOffset: true);
22+
class ListViewPostsState extends State<ListViewPosts> {
23+
24+
var dbHelper = DatabaseHelper();
25+
List<Post> postList;
26+
int count = 0;
27+
28+
@override
29+
Widget build(BuildContext context) {
30+
getPostsIDs();
31+
return Directionality(
32+
textDirection: TextDirection.rtl, // RTL
33+
34+
child: Scaffold(
35+
36+
body: Stack(
37+
children: <Widget>[
38+
39+
RefreshIndicator(
40+
displacement: 150.0,
41+
onRefresh: isExitst,
42+
child: CustomScrollView(
43+
controller: scrollCont,
44+
45+
slivers: <Widget>[
46+
47+
sliverAppBarGlobal(),
48+
sliverListGlobal(),
49+
50+
],
51+
),
52+
),
53+
// _buildFab(),
54+
],
55+
56+
),
57+
),
58+
);
59+
}
60+
}
61+
62+
63+
64+
65+
void scrollToTop() {
66+
scrollCont.animateTo(0.0,
67+
duration: Duration(seconds: 1), curve: Curves.elasticInOut);
68+
}

0 commit comments

Comments
 (0)