Initial commit
This commit is contained in:
81
app_code/lib/custom_ui/Button.dart
Normal file
81
app_code/lib/custom_ui/Button.dart
Normal file
@@ -0,0 +1,81 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
|
||||
class Button extends StatelessWidget {
|
||||
final Color? color;
|
||||
final OutlinedBorder? shape;
|
||||
final Widget child;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final dynamic? minWidth;
|
||||
final dynamic? minHeight;
|
||||
final dynamic? onPressed;
|
||||
final AlignmentGeometry alignment;
|
||||
|
||||
const Button({Key? key, this.color = const Color.fromARGB(0, 0, 0, 0),
|
||||
this.shape = const RoundedRectangleBorder(),
|
||||
required this.child,
|
||||
this.alignment = Alignment.center,
|
||||
this.padding = EdgeInsets.zero,
|
||||
this.minHeight,
|
||||
this.minWidth,
|
||||
|
||||
this.onPressed}) : super(key: key);
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _basic();
|
||||
}
|
||||
|
||||
|
||||
Widget _basic() {
|
||||
//if (width != null && height != null)
|
||||
return TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: ThemeConfig.fontColor,
|
||||
padding: padding,
|
||||
backgroundColor: color,
|
||||
minimumSize: minWidth == null ? null : Size(minWidth.toDouble(),minHeight?? 10),
|
||||
alignment: alignment,
|
||||
shape: shape),
|
||||
onPressed: onPressed,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
static Widget minSize(
|
||||
{required width,
|
||||
required double height,
|
||||
color,
|
||||
shape,
|
||||
child,
|
||||
EdgeInsetsGeometry padding=EdgeInsets.zero,
|
||||
dynamic onPressed}) {
|
||||
return TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
padding: padding,
|
||||
foregroundColor: ThemeConfig.noColor,
|
||||
minimumSize: Size(width.toDouble(), height.toDouble()),
|
||||
backgroundColor: onPressed != null ? color : ThemeConfig.grey,
|
||||
shape: shape,
|
||||
disabledForegroundColor: Colors.blue),
|
||||
child: child,
|
||||
onPressed: onPressed,
|
||||
);
|
||||
}
|
||||
|
||||
static Widget maxSize(
|
||||
{width, height, color, shape, child, dynamic onPressed}) {
|
||||
return TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: ThemeConfig.noColor,
|
||||
maximumSize: Size(width, height),
|
||||
backgroundColor: color,
|
||||
shape: shape),
|
||||
child: child,
|
||||
onPressed: onPressed,
|
||||
);
|
||||
}
|
||||
}
|
||||
144
app_code/lib/custom_ui/Image_view.dart
Normal file
144
app_code/lib/custom_ui/Image_view.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:grostore/helpers/common_functions.dart';
|
||||
|
||||
class ImageView extends StatelessWidget {
|
||||
late String url;
|
||||
double? width, height;
|
||||
double radius;
|
||||
BoxFit? fit;
|
||||
|
||||
ImageView({Key? key, required this.url, this.fit, this.width, this.height ,this.radius = 10.0, })
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child:url.isNotEmpty?
|
||||
CachedNetworkImage(
|
||||
alignment: Alignment.center,
|
||||
imageUrl: url,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: fit,
|
||||
placeholder: (context, url) => Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,fit: fit,),
|
||||
errorWidget: (context, url, error) => _placeHolder(),
|
||||
):
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,),
|
||||
),
|
||||
);
|
||||
|
||||
/// #Eski kod
|
||||
// ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(radius!),
|
||||
// child:url.isNotEmpty?
|
||||
// CachedNetworkImage(
|
||||
// imageUrl: url,
|
||||
// height: height,
|
||||
// width: width,
|
||||
// fit: BoxFit.cover,
|
||||
// placeholder: (context, url) => Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
|
||||
// errorWidget: (context, url, error) => _placeHolder(),
|
||||
// ):
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
|
||||
show(BuildContext context) {
|
||||
return CachedNetworkImage(
|
||||
imageUrl: url,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const Row(
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
height: 10,
|
||||
)
|
||||
],
|
||||
),
|
||||
errorWidget: (context, url, error) => _placeHolder(),
|
||||
);
|
||||
}
|
||||
|
||||
static round({
|
||||
required BuildContext context,
|
||||
required double radius,
|
||||
required url,
|
||||
required height,
|
||||
required width,
|
||||
}) {
|
||||
return Container(
|
||||
height:double.parse(height.toString()) ,
|
||||
width: double.parse(width.toString()),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
|
||||
image:url!=null? DecorationImage(image: NetworkImage(url)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
|
||||
|
||||
),
|
||||
|
||||
);
|
||||
//CircleAvatar()
|
||||
}
|
||||
|
||||
static svg({required String url,double height=40,double width=40}){
|
||||
if( url.isEmpty){
|
||||
return Container(
|
||||
child: _staticPlaceHolder());
|
||||
}
|
||||
|
||||
return SvgPicture.network(
|
||||
url,
|
||||
height:height ,
|
||||
width: width,
|
||||
fit: BoxFit.contain,
|
||||
placeholderBuilder: (BuildContext context) => Container(
|
||||
child: _staticPlaceHolder(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static roundFileImage({
|
||||
required BuildContext context,
|
||||
required double radius,
|
||||
required File file,
|
||||
required height,
|
||||
required width,
|
||||
}){
|
||||
return Container(
|
||||
height:double.parse(height.toString()) ,
|
||||
width: double.parse(width.toString()),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
|
||||
image:file !=null? DecorationImage(image: FileImage(file)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
|
||||
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _placeHolder(){
|
||||
return SizedBox(
|
||||
height: height,
|
||||
width: width,
|
||||
child: Image.asset(getAssetLogo("logo_a.png",),fit: BoxFit.cover,color: ThemeConfig.xxlightGrey,));
|
||||
}
|
||||
static Widget _staticPlaceHolder(){
|
||||
return Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,);
|
||||
}
|
||||
}
|
||||
52
app_code/lib/custom_ui/auth_ui.dart
Normal file
52
app_code/lib/custom_ui/auth_ui.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:grostore/helpers/common_functions.dart';
|
||||
import 'package:grostore/helpers/device_info_helper.dart';
|
||||
|
||||
class AuthScreen{
|
||||
static Widget buildScreen(BuildContext context,Widget child){
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body:Container(
|
||||
alignment: Alignment.center,
|
||||
height: getHeight(context),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(image: AssetImage(getAssetImage("auth_background.png")))
|
||||
),
|
||||
child: CustomScrollView(
|
||||
physics: const BouncingScrollPhysics(
|
||||
parent: AlwaysScrollableScrollPhysics()),
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
|
||||
[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 50.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8,vertical: 12),
|
||||
width: 150,
|
||||
height: 150,
|
||||
decoration: BoxDecoration(
|
||||
color: ThemeConfig.white,
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
child: Image.asset(getAssetLogo("img_logo2.png")),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: StyleConfig.padding),
|
||||
child: child,),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
55
app_code/lib/custom_ui/boxdecorations.dart
Normal file
55
app_code/lib/custom_ui/boxdecorations.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
|
||||
class BoxDecorations{
|
||||
static BoxDecoration basic(){
|
||||
return BoxDecoration(
|
||||
border:Border.all(
|
||||
color: ThemeConfig.lightGrey,
|
||||
width: 1) ,
|
||||
borderRadius: const BorderRadius.all(
|
||||
const Radius.circular(2.0),
|
||||
)
|
||||
);
|
||||
}
|
||||
static BoxDecoration image({required String url,radius =0}){
|
||||
return BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(double.parse(radius.toString())),
|
||||
),
|
||||
image:DecorationImage(image: CachedNetworkImageProvider(url),
|
||||
fit: BoxFit.cover
|
||||
)
|
||||
);
|
||||
}
|
||||
static BoxDecoration shadow({double radius=0.0, }){
|
||||
return BoxDecoration(
|
||||
borderRadius : BorderRadius.all(Radius.circular(radius)),
|
||||
boxShadow : [
|
||||
BoxShadow(
|
||||
color: ThemeConfig.xlightGrey.withOpacity(0.5),
|
||||
offset: Offset(0,1),
|
||||
blurRadius: 2
|
||||
)],
|
||||
color : ThemeConfig.white,
|
||||
);
|
||||
}
|
||||
|
||||
static BoxDecoration customRadius({required BorderRadiusGeometry radius,Color color = ThemeConfig.white }){
|
||||
return BoxDecoration(
|
||||
borderRadius : radius,
|
||||
boxShadow : [
|
||||
BoxShadow(
|
||||
color: ThemeConfig.xlightGrey.withOpacity(0.5),
|
||||
offset: Offset(0,1),
|
||||
blurRadius: 2
|
||||
)],
|
||||
color : color,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
33
app_code/lib/custom_ui/category_ui.dart
Normal file
33
app_code/lib/custom_ui/category_ui.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/custom_ui/Button.dart';
|
||||
import 'package:grostore/custom_ui/Image_view.dart';
|
||||
import 'package:grostore/custom_ui/BoxDecorations.dart';
|
||||
import 'package:grostore/helpers/device_info_helper.dart';
|
||||
|
||||
|
||||
class CategoryUi extends StatelessWidget {
|
||||
late String img,name;
|
||||
CategoryUi({Key? key,required this.img,required this.name}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration:BoxDecorations.shadow(radius: 6.0) ,
|
||||
width: getWidth(context),
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: ImageView(url: img,width:40.0,height: 40.0,)),
|
||||
const SizedBox(height: 8,),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(name,style: StyleConfig.fs12,maxLines: 1,textAlign: TextAlign.center,))
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
43
app_code/lib/custom_ui/common_appbar.dart
Normal file
43
app_code/lib/custom_ui/common_appbar.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:grostore/custom_ui/Boxdecorations.dart';
|
||||
import 'package:grostore/custom_ui/Button.dart';
|
||||
import 'package:grostore/helpers/route.dart';
|
||||
import 'package:grostore/screens/main.dart';
|
||||
|
||||
class CommonAppbar {
|
||||
static AppBar show(
|
||||
{required String title,
|
||||
required BuildContext context,
|
||||
bool showBackButton = true,
|
||||
bool gotoMain = false,
|
||||
PreferredSizeWidget? bottom}) {
|
||||
return AppBar(
|
||||
backgroundColor: ThemeConfig.white,
|
||||
elevation: 0,
|
||||
title: Text(
|
||||
title,
|
||||
style: StyleConfig.fs16fwBold,
|
||||
),
|
||||
centerTitle: true,
|
||||
leading: showBackButton
|
||||
? IconButton(
|
||||
onPressed: (){
|
||||
if (gotoMain) {
|
||||
MakeRoute.goAndRemoveAll(context, const Main());
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
size: 26,
|
||||
color: ThemeConfig.darkGrey,
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
bottom: bottom,
|
||||
);
|
||||
}
|
||||
}
|
||||
122
app_code/lib/custom_ui/filter_dropdown.dart
Normal file
122
app_code/lib/custom_ui/filter_dropdown.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/helpers/device_info_helper.dart';
|
||||
|
||||
|
||||
class FilterDropDown extends StatefulWidget {
|
||||
late List<DropDownFilterModel> model;
|
||||
late Function onSelected;
|
||||
|
||||
FilterDropDown({super.key, required this.onSelected, required this.model});
|
||||
|
||||
@override
|
||||
State<FilterDropDown> createState() => _FilterDropDownState();
|
||||
}
|
||||
|
||||
class _FilterDropDownState extends State<FilterDropDown> {
|
||||
|
||||
TextEditingController controller=TextEditingController();
|
||||
List<DropDownFilterModel> data = [];
|
||||
DropDownFilterModel? selected;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
data.addAll(widget.model);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButton<DropDownFilterModel>(
|
||||
value: selected,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (DropDownFilterModel? value) {
|
||||
widget.onSelected(value);
|
||||
},
|
||||
items: [
|
||||
DropdownMenuItem<DropDownFilterModel>(
|
||||
child: Container(
|
||||
width: getWidth(context)*0.5,
|
||||
height: 40,
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
onChanged: (text)async{
|
||||
if(text.isNotEmpty){
|
||||
List<DropDownFilterModel> tmp =[];
|
||||
for(DropDownFilterModel mo in widget.model){
|
||||
if(mo.name.contains(text)){
|
||||
tmp.add(mo);
|
||||
}
|
||||
}
|
||||
data.clear();
|
||||
data.addAll(tmp);
|
||||
}else{
|
||||
data.clear();
|
||||
data.addAll(widget.model);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
DropdownMenuItem<DropDownFilterModel>(
|
||||
child: Container(
|
||||
width: getWidth(context)*0.5,
|
||||
height: 40,
|
||||
child: TextField(
|
||||
//controller: controller,
|
||||
onChanged: (text)async{
|
||||
if(text.isNotEmpty){
|
||||
List<DropDownFilterModel> tmp =[];
|
||||
for(DropDownFilterModel mo in widget.model){
|
||||
if(mo.name.contains(text)){
|
||||
tmp.add(mo);
|
||||
}
|
||||
}
|
||||
data.clear();
|
||||
data.addAll(tmp);
|
||||
}else{
|
||||
data.clear();
|
||||
data.addAll(widget.model);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
//...item(data),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<DropdownMenuItem<DropDownFilterModel>> item(List<DropDownFilterModel> data) {
|
||||
// data.insert(0, DropDownFilterModel(key: "_search", name: ""));
|
||||
List<DropdownMenuItem<DropDownFilterModel>> items = [];
|
||||
|
||||
for (DropDownFilterModel model in data) {
|
||||
items.add(
|
||||
DropdownMenuItem<DropDownFilterModel>(
|
||||
child: Text(model.name),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DropDownFilterModel {
|
||||
late String key;
|
||||
late String name;
|
||||
|
||||
DropDownFilterModel({required this.key, required this.name});
|
||||
|
||||
}
|
||||
|
||||
|
||||
141
app_code/lib/custom_ui/image_view2.dart
Normal file
141
app_code/lib/custom_ui/image_view2.dart
Normal file
@@ -0,0 +1,141 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:grostore/helpers/common_functions.dart';
|
||||
|
||||
class ImageView2 extends StatelessWidget {
|
||||
late String url;
|
||||
double? width, height;
|
||||
double? radius;
|
||||
|
||||
ImageView2({Key? key, required this.url, this.width, this.height ,this.radius = 0.0})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(radius!),
|
||||
child:url.isNotEmpty?
|
||||
CachedNetworkImage(
|
||||
imageUrl: url,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: BoxFit.cover,
|
||||
// placeholder: (context, url) => Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,fit: BoxFit.contain,),
|
||||
errorWidget: (context, url, error) => _placeHolder(),
|
||||
):
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,),
|
||||
),
|
||||
);
|
||||
|
||||
/// #Eski kod
|
||||
// ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(radius!),
|
||||
// child:url.isNotEmpty?
|
||||
// CachedNetworkImage(
|
||||
// imageUrl: url,
|
||||
// height: height,
|
||||
// width: width,
|
||||
// fit: BoxFit.cover,
|
||||
// placeholder: (context, url) => Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
|
||||
// errorWidget: (context, url, error) => _placeHolder(),
|
||||
// ):
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
|
||||
show(BuildContext context) {
|
||||
return CachedNetworkImage(
|
||||
imageUrl: url,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const Row(
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
height: 10,
|
||||
)
|
||||
],
|
||||
),
|
||||
errorWidget: (context, url, error) => _placeHolder(),
|
||||
);
|
||||
}
|
||||
|
||||
static round({
|
||||
required BuildContext context,
|
||||
required double radius,
|
||||
required url,
|
||||
required height,
|
||||
required width,
|
||||
}) {
|
||||
return Container(
|
||||
height:double.parse(height.toString()) ,
|
||||
width: double.parse(width.toString()),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
|
||||
image:url!=null? DecorationImage(image: NetworkImage(url)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
|
||||
|
||||
),
|
||||
|
||||
);
|
||||
//CircleAvatar()
|
||||
}
|
||||
|
||||
static svg({required String url,double height=40,double width=40}){
|
||||
if( url.isEmpty){
|
||||
return Container(
|
||||
child: _staticPlaceHolder());
|
||||
}
|
||||
|
||||
return SvgPicture.network(
|
||||
url,
|
||||
height:height ,
|
||||
width: width,
|
||||
fit: BoxFit.contain,
|
||||
placeholderBuilder: (BuildContext context) => Container(
|
||||
child: _staticPlaceHolder(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static roundFileImage({
|
||||
required BuildContext context,
|
||||
required double radius,
|
||||
required File file,
|
||||
required height,
|
||||
required width,
|
||||
}){
|
||||
return Container(
|
||||
height:double.parse(height.toString()) ,
|
||||
width: double.parse(width.toString()),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
|
||||
image:file !=null? DecorationImage(image: FileImage(file)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
|
||||
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _placeHolder(){
|
||||
return SizedBox(
|
||||
height: height,
|
||||
width: width,
|
||||
child: Image.asset(getAssetLogo("logo_a.png",),fit: BoxFit.cover,color: ThemeConfig.xxlightGrey,));
|
||||
}
|
||||
static Widget _staticPlaceHolder(){
|
||||
return Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,);
|
||||
}
|
||||
}
|
||||
45
app_code/lib/custom_ui/input_decorations.dart
Normal file
45
app_code/lib/custom_ui/input_decorations.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
|
||||
class InputDecorations {
|
||||
static InputDecoration basic({hint_text = "",Widget? prefixIcon}) {
|
||||
return InputDecoration(
|
||||
prefixIcon: prefixIcon,
|
||||
hintText: hint_text,
|
||||
filled: true,
|
||||
fillColor: ThemeConfig.white,
|
||||
hintStyle: TextStyle(fontSize: 12.0, color: ThemeConfig.lightGrey),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ThemeConfig.lightGrey,
|
||||
width: 1),
|
||||
borderRadius: const BorderRadius.all(
|
||||
const Radius.circular(2.0),
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ThemeConfig.lightGrey,
|
||||
width: 1),
|
||||
borderRadius: const BorderRadius.all(
|
||||
const Radius.circular(2.0),
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0));
|
||||
}
|
||||
|
||||
static InputDecoration phone({hint_text = "",Widget?prefixIcon}) {
|
||||
return InputDecoration(
|
||||
// prefixIcon: prefixIcon,
|
||||
hintText: hint_text,
|
||||
hintStyle: TextStyle(fontSize: 12.0, color: ThemeConfig.lightGrey),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: ThemeConfig.lightGrey, width: 1),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: ThemeConfig.red, width: 1),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10))),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0));
|
||||
}
|
||||
}
|
||||
31
app_code/lib/custom_ui/loading.dart
Normal file
31
app_code/lib/custom_ui/loading.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/app_lang.dart';
|
||||
|
||||
class Loading{
|
||||
static BuildContext? _context;
|
||||
|
||||
static show(BuildContext context){
|
||||
Loading._context=context;
|
||||
showDialog(context: context, builder: (context){
|
||||
return AlertDialog(content: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(width: 20,),
|
||||
Text(AppLang.local(context).please_wait_ucf),
|
||||
],
|
||||
),
|
||||
),);
|
||||
});
|
||||
}
|
||||
|
||||
static close(){
|
||||
if(Loading._context!=null){
|
||||
Navigator.pop(_context!);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
app_code/lib/custom_ui/no_data.dart
Normal file
23
app_code/lib/custom_ui/no_data.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/app_lang.dart';
|
||||
import 'package:grostore/helpers/device_info_helper.dart';
|
||||
|
||||
|
||||
class NoData extends StatefulWidget {
|
||||
const NoData({super.key});
|
||||
|
||||
@override
|
||||
State<NoData> createState() => _NoDataState();
|
||||
}
|
||||
|
||||
class _NoDataState extends State<NoData> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: getHeight(context),
|
||||
child: Center(
|
||||
child: Text(AppLang.local(context).data_is_not_available),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
144
app_code/lib/custom_ui/order_item.dart
Normal file
144
app_code/lib/custom_ui/order_item.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:grostore/app_lang.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:grostore/custom_ui/BoxDecorations.dart';
|
||||
import 'package:grostore/custom_ui/Button.dart';
|
||||
import 'package:grostore/custom_ui/Image_view.dart';
|
||||
import 'package:grostore/helpers/common_functions.dart';
|
||||
import 'package:grostore/helpers/device_info_helper.dart';
|
||||
import 'package:grostore/models/order/order_details_response.dart';
|
||||
import 'package:grostore/presenters/refund_presenter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OrderItem extends StatelessWidget {
|
||||
Item item;
|
||||
RefundResult? onReq;
|
||||
BuildContext context;
|
||||
|
||||
OrderItem({super.key, required this.item, required this.context,this.onReq});
|
||||
|
||||
TextEditingController controller = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
//width: (getWidth(context)*0.5)-24,
|
||||
height: 160,
|
||||
decoration: BoxDecorations.shadow(radius: 8),
|
||||
//padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 160,
|
||||
// height: 50,
|
||||
// padding: EdgeInsets.only(top: 10),
|
||||
alignment: Alignment.center,
|
||||
child: ImageView(
|
||||
url: item.product?.thumbnailImage ?? "",
|
||||
width: 134,
|
||||
height: 92,
|
||||
)),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, top: 12),
|
||||
child: Text(
|
||||
item.product?.categories.first.name ?? "",
|
||||
style: StyleConfig.fs10,
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, top: 4),
|
||||
child: Text(
|
||||
item.product?.name ?? "",
|
||||
style: StyleConfig.fs14fwBold,
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, top: 8),
|
||||
child: Text(
|
||||
"${item.qty} x ${showPrice(item.product?.price ?? '')}",
|
||||
style: StyleConfig.fs14cRedfwBold,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12.0, top: 8),
|
||||
child: Text(
|
||||
showPrice(item.totalPrice ?? ""),
|
||||
style: StyleConfig.fs14cRedfwBold,
|
||||
),
|
||||
),
|
||||
if(item.refund_status!="off")
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5),
|
||||
alignment: Alignment.center,
|
||||
child: Button(
|
||||
onPressed: item.refund_status == "request"
|
||||
? (){
|
||||
refundDialog();
|
||||
}:null,
|
||||
shape: StyleConfig.buttonRadius(5),
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
color: item.refund_status == "request"
|
||||
? ThemeConfig.accentColor
|
||||
: null,
|
||||
child: Text(
|
||||
"Refund ${item.refund_status.toString()}".toUpperCase(),
|
||||
style: item.refund_status == "request"
|
||||
? StyleConfig.fs12cWhite
|
||||
: StyleConfig.fs12,
|
||||
)
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
refundDialog() {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text("Refund Reason"),
|
||||
content: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
|
||||
decoration: BoxDecorations.basic().copyWith(border: Border.all(color: ThemeConfig.grey)),
|
||||
height: 100,
|
||||
width: getWidth(context) * 0.5,
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration.collapsed(hintText: "reason"),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Button(
|
||||
color: ThemeConfig.accentColor,
|
||||
onPressed:() {
|
||||
Navigator.pop(context);
|
||||
Provider.of<RefundPresenter>(context, listen: false)
|
||||
.refundReq(this.context,item.id,controller.text.trim()).then((value) => onReq != null?onReq!(value):null);
|
||||
},
|
||||
child: Text(AppLang.local(context).submit,style: StyleConfig.fs12cWhite,))
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
typedef RefundResult = Function(bool value);
|
||||
|
||||
|
||||
|
||||
|
||||
70
app_code/lib/custom_ui/order_view_model.dart
Normal file
70
app_code/lib/custom_ui/order_view_model.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/custom_ui/BoxDecorations.dart';
|
||||
import 'package:grostore/custom_ui/Button.dart';
|
||||
import 'package:grostore/custom_ui/Image_view.dart';
|
||||
import 'package:grostore/helpers/device_info_helper.dart';
|
||||
import 'package:grostore/helpers/route.dart';
|
||||
import 'package:grostore/models/order/orders_response.dart';
|
||||
import 'package:grostore/screens/order/order_details.dart';
|
||||
|
||||
|
||||
class OrderViewModel extends StatelessWidget {
|
||||
OrderViewModel({Key? key ,required this.orderInfo,required this.context}) : super(key: key);
|
||||
OrderInfo orderInfo;
|
||||
// int orderId;
|
||||
BuildContext context;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: getWidth(this.context),
|
||||
height: 100,
|
||||
padding: EdgeInsets.symmetric(horizontal: StyleConfig.padding),
|
||||
decoration: BoxDecorations.shadow(radius: 2),
|
||||
child: Button(
|
||||
onPressed: (){
|
||||
print("} ${orderInfo.id} {");
|
||||
MakeRoute.go(this.context, OrderDetails(code: orderInfo.group_id,));
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Image(image: AssetImage("assets/logos/logo_a.png"),)
|
||||
),
|
||||
Expanded(
|
||||
flex:3,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: getWidth(this.context)*0.50,
|
||||
child: Text("Buyurtma raqami: ${orderInfo.group_id}",style: StyleConfig.fs16,)),
|
||||
// SizedBox(
|
||||
// width: getWidth(this.context)*0.50,
|
||||
// child: Text(orderInfo.item.product?.categories.first.name??"",style: StyleConfig.fs14fwNormal,)),
|
||||
SizedBox(
|
||||
width: getWidth(this.context)*0.50,
|
||||
child: Text("Umumiy summa: ${orderInfo.item.totalPrice}",style: StyleConfig.fs14fwBold,)),
|
||||
SizedBox(
|
||||
width: getWidth(this.context)*0.50,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("Buyurtma sanasi:",style: StyleConfig.fs12,maxLines: 1,),
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: Text("${orderInfo.date.year}/0${orderInfo.date.day}/0${orderInfo.date.month}",style: StyleConfig.fs11,maxLines: 1,textAlign: TextAlign.right,)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
192
app_code/lib/custom_ui/product_card.dart
Normal file
192
app_code/lib/custom_ui/product_card.dart
Normal file
@@ -0,0 +1,192 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:grostore/custom_classes/system_data.dart';
|
||||
import 'package:grostore/custom_ui/Button.dart';
|
||||
import 'package:grostore/custom_ui/Image_view.dart';
|
||||
import 'package:grostore/custom_ui/BoxDecorations.dart';
|
||||
import 'package:grostore/helpers/common_functions.dart';
|
||||
import 'package:grostore/helpers/route.dart';
|
||||
import 'package:grostore/models/product_mini_response.dart';
|
||||
import 'package:grostore/presenters/cart_presenter.dart';
|
||||
import 'package:grostore/screens/auth/login.dart';
|
||||
import 'package:grostore/screens/product_details.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
||||
class ProductCard extends StatelessWidget {
|
||||
late ProductMini product;
|
||||
late BuildContext context;
|
||||
ProductCard({Key? key,required this.product ,required this.context}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 160,
|
||||
height: 160,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecorations.shadow(radius: 8),
|
||||
//padding: EdgeInsets.all(8),
|
||||
child: Stack(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Button(
|
||||
minWidth: MediaQuery.sizeOf(context).width,
|
||||
onPressed: (){
|
||||
MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex:7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Hero(
|
||||
tag: product,
|
||||
child: ImageView(url: product.thumbnailImage,fit: BoxFit.contain,)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8,left: 8,right: 28,top: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
flex:6,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(product.categories.first.name,style: StyleConfig.fs10,overflow: TextOverflow.ellipsis,),
|
||||
SizedBox(width: MediaQuery.sizeOf(context).width,child: Text(product.name,style: StyleConfig.fs14fwBold,maxLines: 2,overflow: TextOverflow.ellipsis,)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(showPrice(product.price),style: StyleConfig.fs14cRedfwBold,),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
/// #Add Button
|
||||
Positioned(
|
||||
bottom: -4,
|
||||
right: -4,
|
||||
child: Button.minSize(
|
||||
color: ThemeConfig.fontColor,
|
||||
onPressed: (){
|
||||
if(SystemData.isLogIn){
|
||||
if(product.variations.length==1) {
|
||||
Provider.of<CartPresenter>(context, listen: false)
|
||||
.addToCart(product.variations.first.id, 1, context);
|
||||
}else{
|
||||
MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
|
||||
}
|
||||
}else{
|
||||
MakeRoute.productRoute(this.context, const Login());
|
||||
}
|
||||
|
||||
},
|
||||
width: 40,
|
||||
height: 40,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8),bottomRight: Radius.circular(8))),
|
||||
child: const Icon(Icons.add,color: ThemeConfig.white,),
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
/// #Eski kod
|
||||
// Container(
|
||||
// width: 160,
|
||||
// height: 160,
|
||||
// decoration: BoxDecorations.shadow(radius: 8),
|
||||
// //padding: EdgeInsets.all(8),
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// Button(
|
||||
// minWidth: 160,
|
||||
// onPressed: (){
|
||||
// MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
|
||||
// },
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: 160,
|
||||
// // padding: EdgeInsets.only(top: 10),
|
||||
// alignment: Alignment.center,
|
||||
// child: Hero(
|
||||
// tag: product,
|
||||
// child: ImageView(url: product.thumbnailImage,width: 134,height: 92,))),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 12.0,top: 12),
|
||||
// child: Text(product.categories.first.name,style: StyleConfig.fs10,),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 12.0,top: 4),
|
||||
// child: Text(product.name,style: StyleConfig.fs14fwBold,maxLines: 2,),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 12.0,top: 8),
|
||||
// child: Text(showPrice(product.price),style: StyleConfig.fs14cRedfwBold,),
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// bottom: -4,
|
||||
// right: -4,
|
||||
// child: Button.minSize(
|
||||
// color: ThemeConfig.fontColor,
|
||||
// onPressed: (){
|
||||
// if(SystemData.isLogIn){
|
||||
// if(product.variations.length==1) {
|
||||
// Provider.of<CartPresenter>(context, listen: false)
|
||||
// .addToCart(product.variations.first.id, 1, context);
|
||||
// }else{
|
||||
// MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
|
||||
//
|
||||
// }
|
||||
// }else{
|
||||
// MakeRoute.productRoute(this.context, Login());
|
||||
//
|
||||
// }
|
||||
//
|
||||
// },
|
||||
// width: 40,
|
||||
// height: 40,
|
||||
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8),bottomRight: Radius.circular(8))),
|
||||
// child: Icon(Icons.add,color: ThemeConfig.white,),
|
||||
// )),
|
||||
// ],
|
||||
// ),
|
||||
//
|
||||
// );
|
||||
}
|
||||
}
|
||||
84
app_code/lib/custom_ui/shimmers.dart
Normal file
84
app_code/lib/custom_ui/shimmers.dart
Normal file
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
class Shimmers extends StatelessWidget {
|
||||
late double width, height;
|
||||
double? radius;
|
||||
|
||||
Shimmers(
|
||||
{Key? key, required this.width, required this.height, this.radius = 0})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: width,
|
||||
height: height,
|
||||
child: Shimmer.fromColors(
|
||||
baseColor: ThemeConfig.xlightGrey,
|
||||
highlightColor: ThemeConfig.lightGrey,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ThemeConfig.mediumGrey,
|
||||
borderRadius:
|
||||
radius != null ? BorderRadius.circular(radius!) : null,
|
||||
),
|
||||
width: width,
|
||||
height: height),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static list(int items, double width, double height) {
|
||||
return ListView.separated(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return Shimmers(width: width, height: height);
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
return const SizedBox(
|
||||
height: 10,
|
||||
);
|
||||
},
|
||||
itemCount: items);
|
||||
}
|
||||
|
||||
static horizontalList(int items, double width, double height) {
|
||||
return ListView.separated(
|
||||
padding: EdgeInsets.symmetric(horizontal: StyleConfig.padding),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
return Shimmers(width: width, height: height);
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
return const SizedBox(
|
||||
width: 10,
|
||||
);
|
||||
},
|
||||
itemCount: items);
|
||||
}
|
||||
|
||||
static gridShimmer(int crossAxisCount, int items,
|
||||
{double width = 160, double height = 186, double radius = 8}) {
|
||||
return GridView.builder(
|
||||
padding: EdgeInsets.symmetric(horizontal: StyleConfig.padding),
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: crossAxisCount,
|
||||
crossAxisSpacing: 16,
|
||||
mainAxisSpacing: 16,
|
||||
childAspectRatio: 0.8),
|
||||
itemCount: items,
|
||||
itemBuilder: (context, index) {
|
||||
return Shimmers(
|
||||
width: double.parse(width.toString()),
|
||||
height: double.parse(height.toString()),
|
||||
radius: double.parse(radius.toString()),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
70
app_code/lib/custom_ui/toast_ui.dart
Normal file
70
app_code/lib/custom_ui/toast_ui.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grostore/configs/style_config.dart';
|
||||
import 'package:grostore/configs/theme_config.dart';
|
||||
import 'package:grostore/helpers/route.dart';
|
||||
import 'package:grostore/screens/cart.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
|
||||
|
||||
class ToastUi{
|
||||
static simpleToast(context,message){
|
||||
ToastContext().init(context);
|
||||
return Toast.show(
|
||||
message,
|
||||
border: Border.all(color: ThemeConfig.fontColor,width: 1),
|
||||
backgroundColor: ThemeConfig.white,
|
||||
textStyle: StyleConfig.fs14fwNormal,
|
||||
duration: Toast.lengthLong,gravity: Toast.center);
|
||||
}
|
||||
|
||||
static show(BuildContext mainContext,message){
|
||||
showDialog(
|
||||
context: mainContext, builder: (context){
|
||||
Future.delayed(const Duration(milliseconds: 250)).then((value) => Navigator.pop(mainContext));
|
||||
return AlertDialog(
|
||||
content: Text(message,style: StyleConfig.fs14fwNormal,),);
|
||||
});
|
||||
}
|
||||
|
||||
static show3(BuildContext mainContext,message){
|
||||
showDialog(
|
||||
context: mainContext, builder: (context){
|
||||
Future.delayed(const Duration(milliseconds: 1200)).then((value) => Navigator.pop(mainContext));
|
||||
return AlertDialog(
|
||||
backgroundColor: Colors.white,
|
||||
content: Text(message,style: StyleConfig.fs14fwNormal,),);
|
||||
});
|
||||
}
|
||||
static showAdd(BuildContext mainContext,message){
|
||||
showDialog(
|
||||
useSafeArea: false,
|
||||
barrierDismissible: true,
|
||||
barrierColor: Colors.transparent,
|
||||
context: mainContext, builder: (context){
|
||||
Future.delayed(const Duration(milliseconds: 250)).then((value) => Navigator.pop(mainContext));
|
||||
return AlertDialog(
|
||||
elevation: 0,
|
||||
content: InkWell(
|
||||
onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (_)=> const Cart()));
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 20,
|
||||
child: Text(message,style: StyleConfig.fs14fwNormal,))),);
|
||||
});
|
||||
}
|
||||
static showAdd2(BuildContext mainContext,message){
|
||||
showDialog(
|
||||
// useSafeArea: false,
|
||||
// barrierDismissible: true,
|
||||
// barrierColor: Colors.transparent,
|
||||
context: mainContext, builder: (context){
|
||||
// Future.delayed(const Duration(milliseconds: 200)).then((value) => Navigator.pop(mainContext));
|
||||
return AlertDialog(
|
||||
// elevation: 0,
|
||||
content: InkWell(
|
||||
onTap: (){},
|
||||
child: Text(message,style: StyleConfig.fs14fwNormal,)),);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user