Skip to content

Commit f42e66e

Browse files
committed
all issue fixed
2 parents 09b41af + 06ef1ec commit f42e66e

35 files changed

+588
-585
lines changed

best_flutter_ui_templates/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@
241241
/* Begin XCBuildConfiguration section */
242242
249021D3217E4FDB00AE95B9 /* Profile */ = {
243243
isa = XCBuildConfiguration;
244-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
245244
buildSettings = {
246245
ALWAYS_SEARCH_USER_PATHS = NO;
247246
CLANG_ANALYZER_NONNULL = YES;
@@ -318,7 +317,6 @@
318317
};
319318
97C147031CF9000F007C117D /* Debug */ = {
320319
isa = XCBuildConfiguration;
321-
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
322320
buildSettings = {
323321
ALWAYS_SEARCH_USER_PATHS = NO;
324322
CLANG_ANALYZER_NONNULL = YES;
@@ -374,7 +372,6 @@
374372
};
375373
97C147041CF9000F007C117D /* Release */ = {
376374
isa = XCBuildConfiguration;
377-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
378375
buildSettings = {
379376
ALWAYS_SEARCH_USER_PATHS = NO;
380377
CLANG_ANALYZER_NONNULL = YES;

best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

best_flutter_ui_templates/lib/custom_drawer/drawer_user_controller.dart

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
44

55
class DrawerUserController extends StatefulWidget {
66
const DrawerUserController({
7-
Key key,
7+
Key? key,
88
this.drawerWidth = 250,
99
this.onDrawerCall,
1010
this.screenView,
@@ -15,63 +15,63 @@ class DrawerUserController extends StatefulWidget {
1515
}) : super(key: key);
1616

1717
final double drawerWidth;
18-
final Function(DrawerIndex) onDrawerCall;
19-
final Widget screenView;
20-
final Function(bool) drawerIsOpen;
21-
final AnimatedIconData animatedIconData;
22-
final Widget menuView;
23-
final DrawerIndex screenIndex;
18+
final Function(DrawerIndex)? onDrawerCall;
19+
final Widget? screenView;
20+
final Function(bool)? drawerIsOpen;
21+
final AnimatedIconData? animatedIconData;
22+
final Widget? menuView;
23+
final DrawerIndex? screenIndex;
2424

2525
@override
2626
_DrawerUserControllerState createState() => _DrawerUserControllerState();
2727
}
2828

2929
class _DrawerUserControllerState extends State<DrawerUserController> with TickerProviderStateMixin {
30-
ScrollController scrollController;
31-
AnimationController iconAnimationController;
32-
AnimationController animationController;
30+
ScrollController? scrollController;
31+
AnimationController? iconAnimationController;
32+
AnimationController? animationController;
3333

3434
double scrolloffset = 0.0;
3535

3636
@override
3737
void initState() {
3838
animationController = AnimationController(duration: const Duration(milliseconds: 2000), vsync: this);
3939
iconAnimationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 0));
40-
iconAnimationController..animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn);
40+
iconAnimationController?..animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn);
4141
scrollController = ScrollController(initialScrollOffset: widget.drawerWidth);
42-
scrollController
42+
scrollController!
4343
..addListener(() {
44-
if (scrollController.offset <= 0) {
44+
if (scrollController!.offset <= 0) {
4545
if (scrolloffset != 1.0) {
4646
setState(() {
4747
scrolloffset = 1.0;
4848
try {
49-
widget.drawerIsOpen(true);
49+
widget.drawerIsOpen!(true);
5050
} catch (_) {}
5151
});
5252
}
53-
iconAnimationController.animateTo(0.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn);
54-
} else if (scrollController.offset > 0 && scrollController.offset < widget.drawerWidth.floor()) {
55-
iconAnimationController.animateTo((scrollController.offset * 100 / (widget.drawerWidth)) / 100,
53+
iconAnimationController?.animateTo(0.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn);
54+
} else if (scrollController!.offset > 0 && scrollController!.offset < widget.drawerWidth.floor()) {
55+
iconAnimationController?.animateTo((scrollController!.offset * 100 / (widget.drawerWidth)) / 100,
5656
duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn);
5757
} else {
5858
if (scrolloffset != 0.0) {
5959
setState(() {
6060
scrolloffset = 0.0;
6161
try {
62-
widget.drawerIsOpen(false);
62+
widget.drawerIsOpen!(false);
6363
} catch (_) {}
6464
});
6565
}
66-
iconAnimationController.animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn);
66+
iconAnimationController?.animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn);
6767
}
6868
});
69-
WidgetsBinding.instance.addPostFrameCallback((_) => getInitState());
69+
WidgetsBinding.instance?.addPostFrameCallback((_) => getInitState());
7070
super.initState();
7171
}
7272

7373
Future<bool> getInitState() async {
74-
scrollController.jumpTo(
74+
scrollController?.jumpTo(
7575
widget.drawerWidth,
7676
);
7777
return true;
@@ -96,18 +96,18 @@ class _DrawerUserControllerState extends State<DrawerUserController> with Ticker
9696
//we divided first drawer Width with HomeDrawer and second full-screen Width with all home screen, we called screen View
9797
height: MediaQuery.of(context).size.height,
9898
child: AnimatedBuilder(
99-
animation: iconAnimationController,
100-
builder: (BuildContext context, Widget child) {
99+
animation: iconAnimationController!,
100+
builder: (BuildContext context, Widget? child) {
101101
return Transform(
102102
//transform we use for the stable drawer we, not need to move with scroll view
103-
transform: Matrix4.translationValues(scrollController.offset, 0.0, 0.0),
103+
transform: Matrix4.translationValues(scrollController!.offset, 0.0, 0.0),
104104
child: HomeDrawer(
105105
screenIndex: widget.screenIndex == null ? DrawerIndex.HOME : widget.screenIndex,
106106
iconAnimationController: iconAnimationController,
107107
callBackIndex: (DrawerIndex indexType) {
108108
onDrawerClick();
109109
try {
110-
widget.onDrawerCall(indexType);
110+
widget.onDrawerCall!(indexType);
111111
} catch (e) {}
112112
},
113113
),
@@ -155,8 +155,8 @@ class _DrawerUserControllerState extends State<DrawerUserController> with Ticker
155155
child: widget.menuView != null
156156
? widget.menuView
157157
: AnimatedIcon(
158-
icon: widget.animatedIconData != null ? widget.animatedIconData : AnimatedIcons.arrow_menu,
159-
progress: iconAnimationController),
158+
icon: widget.animatedIconData ?? AnimatedIcons.arrow_menu,
159+
progress: iconAnimationController!),
160160
),
161161
onTap: () {
162162
FocusScope.of(context).requestFocus(FocusNode());
@@ -179,14 +179,14 @@ class _DrawerUserControllerState extends State<DrawerUserController> with Ticker
179179

180180
void onDrawerClick() {
181181
//if scrollcontroller.offset != 0.0 then we set to closed the drawer(with animation to offset zero position) if is not 1 then open the drawer
182-
if (scrollController.offset != 0.0) {
183-
scrollController.animateTo(
182+
if (scrollController!.offset != 0.0) {
183+
scrollController?.animateTo(
184184
0.0,
185185
duration: const Duration(milliseconds: 400),
186186
curve: Curves.fastOutSlowIn,
187187
);
188188
} else {
189-
scrollController.animateTo(
189+
scrollController?.animateTo(
190190
widget.drawerWidth,
191191
duration: const Duration(milliseconds: 400),
192192
curve: Curves.fastOutSlowIn,

best_flutter_ui_templates/lib/custom_drawer/home_drawer.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import 'package:best_flutter_ui_templates/app_theme.dart';
22
import 'package:flutter/material.dart';
33

44
class HomeDrawer extends StatefulWidget {
5-
const HomeDrawer({Key key, this.screenIndex, this.iconAnimationController, this.callBackIndex}) : super(key: key);
5+
const HomeDrawer({Key? key, this.screenIndex, this.iconAnimationController, this.callBackIndex}) : super(key: key);
66

7-
final AnimationController iconAnimationController;
8-
final DrawerIndex screenIndex;
9-
final Function(DrawerIndex) callBackIndex;
7+
final AnimationController? iconAnimationController;
8+
final DrawerIndex? screenIndex;
9+
final Function(DrawerIndex)? callBackIndex;
1010

1111
@override
1212
_HomeDrawerState createState() => _HomeDrawerState();
1313
}
1414

1515
class _HomeDrawerState extends State<HomeDrawer> {
16-
List<DrawerList> drawerList;
16+
List<DrawerList>? drawerList;
1717
@override
1818
void initState() {
1919
setDrawerListArray();
@@ -74,13 +74,13 @@ class _HomeDrawerState extends State<HomeDrawer> {
7474
mainAxisAlignment: MainAxisAlignment.start,
7575
children: <Widget>[
7676
AnimatedBuilder(
77-
animation: widget.iconAnimationController,
78-
builder: (BuildContext context, Widget child) {
77+
animation: widget.iconAnimationController!,
78+
builder: (BuildContext context, Widget? child) {
7979
return ScaleTransition(
80-
scale: AlwaysStoppedAnimation<double>(1.0 - (widget.iconAnimationController.value) * 0.2),
80+
scale: AlwaysStoppedAnimation<double>(1.0 - (widget.iconAnimationController!.value) * 0.2),
8181
child: RotationTransition(
8282
turns: AlwaysStoppedAnimation<double>(Tween<double>(begin: 0.0, end: 24.0)
83-
.animate(CurvedAnimation(parent: widget.iconAnimationController, curve: Curves.fastOutSlowIn))
83+
.animate(CurvedAnimation(parent: widget.iconAnimationController!, curve: Curves.fastOutSlowIn))
8484
.value /
8585
360),
8686
child: Container(
@@ -127,9 +127,9 @@ class _HomeDrawerState extends State<HomeDrawer> {
127127
child: ListView.builder(
128128
physics: const BouncingScrollPhysics(),
129129
padding: const EdgeInsets.all(0.0),
130-
itemCount: drawerList.length,
130+
itemCount: drawerList?.length,
131131
itemBuilder: (BuildContext context, int index) {
132-
return inkwell(drawerList[index]);
132+
return inkwell(drawerList![index]);
133133
},
134134
),
135135
),
@@ -179,7 +179,7 @@ class _HomeDrawerState extends State<HomeDrawer> {
179179
splashColor: Colors.grey.withOpacity(0.1),
180180
highlightColor: Colors.transparent,
181181
onTap: () {
182-
navigationtoScreen(listData.index);
182+
navigationtoScreen(listData.index!);
183183
},
184184
child: Stack(
185185
children: <Widget>[
@@ -211,7 +211,7 @@ class _HomeDrawerState extends State<HomeDrawer> {
211211
height: 24,
212212
child: Image.asset(listData.imageName, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack),
213213
)
214-
: Icon(listData.icon.icon, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack),
214+
: Icon(listData.icon?.icon, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack),
215215
const Padding(
216216
padding: EdgeInsets.all(4.0),
217217
),
@@ -229,11 +229,11 @@ class _HomeDrawerState extends State<HomeDrawer> {
229229
),
230230
widget.screenIndex == listData.index
231231
? AnimatedBuilder(
232-
animation: widget.iconAnimationController,
233-
builder: (BuildContext context, Widget child) {
232+
animation: widget.iconAnimationController!,
233+
builder: (BuildContext context, Widget? child) {
234234
return Transform(
235235
transform: Matrix4.translationValues(
236-
(MediaQuery.of(context).size.width * 0.75 - 64) * (1.0 - widget.iconAnimationController.value - 1.0), 0.0, 0.0),
236+
(MediaQuery.of(context).size.width * 0.75 - 64) * (1.0 - widget.iconAnimationController!.value - 1.0), 0.0, 0.0),
237237
child: Padding(
238238
padding: EdgeInsets.only(top: 8, bottom: 8),
239239
child: Container(
@@ -261,7 +261,7 @@ class _HomeDrawerState extends State<HomeDrawer> {
261261
}
262262

263263
Future<void> navigationtoScreen(DrawerIndex indexScreen) async {
264-
widget.callBackIndex(indexScreen);
264+
widget.callBackIndex!(indexScreen);
265265
}
266266
}
267267

@@ -285,8 +285,8 @@ class DrawerList {
285285
});
286286

287287
String labelName;
288-
Icon icon;
288+
Icon? icon;
289289
bool isAssetsImage;
290290
String imageName;
291-
DrawerIndex index;
291+
DrawerIndex? index;
292292
}

0 commit comments

Comments
 (0)