grock 0.0.4+1 grock: ^0.0.4+1 copied to clipboard
Snackbars and tools.
Grock #
This is an excellent Flutter package mate 💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯
Firstly 🤫 #
return MaterialApp(
debugShowCheckedModeBanner: false,
navigatorKey: Grock.navigationKey, // added line
scaffoldMessengerKey: Grock.snackbarMessengerKey, // added line
title: 'Material App',
home: Home(),
);
NO CONTEXT NAVİGATİONS 😱 #
Grock.to || toRemove || back() #
GrockContainer(
onTap: (){
// for Navigator.push(...)
Grock.to(Nextpage());
Grock.to(NextPage(), type: NavType.bottomToTop); // optional navigate animation
// for Navigator.pushAndRemoveUntil(context, newRoute, (route) => false)
Grock.toRemove(NextPage());
// for Navigator.of(context).pop()
Grock.back();
Grock.back(result: "Return Object") // optional return object
},
)
Widgets 👊 🚀 #
GrockContainer #
GrockContainer(
onTap: ()=>print("tapped"),
child: Text("On Tap Container")
)
GrockDropdownButton #
GrockDropdownButton(
items: [
for (var item in items)
GrockDropdownMenuItem(
child: Text(item),
onPressed: (String? newValue) {
setState(() {
currentValue = newValue;
});
Grock.back();
},
decoration: BoxDecoration(
color: currentValue == item
? Colors.grey.shade200
: Colors.white,
),
trailingWidget: currentValue == item
? const Icon(Icons.check, color: Colors.green)
: null,
),
],
value: currentValue,
hintText: "Lütfen bir item seçin",
),
GrockList #
GrockList(
isExpanded: true,
itemSpace: const Divider(),
itemCount: 10,
itemBuilder: (context,index)=>Text("Custom ListView Builder"),
)
GrockGlassmorphism #
GrockGlassMorphism(
blur: 20,
opacity: 0.2,
child: Image(".../images.png") or Container(child: Icon(Icons.search)),
color: Colors.white,
),
GrockKeyboardClose #
return GrockKeyboardClose(
child: Scaffold(
// Scaffold on tap and close keyboard
body: TextField(
),
),
);
GrockScrollEffect #
return GrockScrollEffect(
child: Scaffold(
// drag and scroll effect disable
body: ListView.builder(
....
),
),
);
GrockLoadingWidget #
body: GrockLoadingWidget(
isLoading: isLoading,
loadedChild: ListView.builder(
...
),),
loadingChild: Center(child: CircleProgressIndıcator()),
errorChild: Center(child: Text('error')),
showDialog: true,
loadingDialogWidget: Grock.dialog(
... loading lottie or gif widgets
),
Snackbar and Dialog (BUT NO CONTEXT 😁) #
Grock.snackBar #
TextButton(
child: const Text('No Context Snackbar'),
Grock.snackBar(
title: "Snackbar",
description: "Snackbar content",
blur: 20,
opacity: 0.2,
icon: Icons.error,
curve: Curves.elasticInOut,
padding: 15,
durationMillisecond: 2000,
borderRadius: 10,
... vs parameters
),
),
Grock.dialog #
TextButton(
child: const Text('No Context Dialog'),
onPressed: () {
Grock.dialog(builder: (context) {
return const AlertDialog(
title: Text('Dialog'),
content: Text('Dialog content'),
);
});
},
),
Widget Tools 🤩 #
context tools #
context.bottom, // SafeArea Bottom
context.top, // SafeArea Top
context.isKeyBoardOpen, // true or false
context.mediaQuery,
no CONTEXT tools #
Grock.height,
Grock.width,
Grock.bottomCenter,
Grock.bottomLeft,
Grock.bottomRight,
Grock.center,
Grock.centerLeft,
Grock.centerRight,
Grock.topLeft,
Grock.topRight,
Grock.topCenter,
Grock.deviceWidth,
Grock.deviceHeight,
Grock.getVersion(),
Grock.isIOS,
Grock.isAndroid,
Grock.isMacOS,
Grock.isWindows,
Grock.isLinux,
Grock.isFuchsia,
Grock.isDebugMode,
Grock.isReleaseMode,
Grock.isProfileMode,
Padding or Margin and BorderRadius #
GrockContainer(
margin: 10.verticalP,
// margin: 10.horizontalP,
// margin: 10.allP,
padding: [20,40].horizontalAndVerticalP,
// padding: [10,13,14,12].paddingLTRB
width: Grock.width * 0.3,
height: Grock.height * 0.1,
decoration: BoxDecoration(
borderRadius: 15.allBR,
),
),
Random Online Image #
GrockList(
isExpanded: true,
itemSpace: const Divider(),
itemCount: 10,
itemBuilder: (context,index)=>Image.network(
index.randomImage(), // width and height optional
),
)