playx_widget 0.0.6 playx_widget: ^0.0.6 copied to clipboard
Playx Package that contains utility widgets as it contains common widgets and utilities that are needed in each project .
import 'package:flutter/material.dart';
import 'package:playx_widget/playx_widget.dart';
void main() async {
runApp(ScreenUtilInit(
designSize: const Size(360, 690),
minTextAdapt: true,
splitScreenMode: true,
builder: (context, child) {
return const MaterialApp(title: 'Flutter Demo', home: MyApp());
}));
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Playx Example'),
),
body: OptimizedScrollView(
child: Column(
children: [
const SizedBox(
height: 100,
),
const SizedBox(
height: 100,
child: AppVersion(
prefix: 'Version ',
),
),
const SizedBox(
height: 100,
child: CenterLoading(
color: Colors.blue,
),
),
const OptimizedCard(
margin: EdgeInsets.all(16),
innerCardShadowMargin: EdgeInsets.all(4),
width: double.infinity,
height: 200,
padding: EdgeInsets.all(12),
child: Center(child: Text('Ahmed Mohamed')),
),
OptimizedListTile(
leading: const Icon(Icons.speed),
title: SizedBox(
width: double.infinity,
child: Text(
'Speed',
textAlign: TextAlign.start,
style: TextStyle(fontSize: 14.sp),
)),
subtitle: SizedBox(
width: double.infinity,
child: Text(
'30 km/h',
style: TextStyle(fontSize: 12.sp),
textAlign: TextAlign.start,
)),
trailing: const Icon(Icons.car_repair),
contentPadding:
EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
horizontalSpace: 8.w,
),
ImageViewer.cachedNetwork(
'https://avatars.githubusercontent.com/u/35397170?s=200&v=4',
height: 100,
),
SizedBox(
height: 100,
width: double.infinity,
child: AutoAnimatedList(
items: const ['Ahmed', 'Mohamed', 'Mohsen'],
itemBuilder: (BuildContext context, String item, int index) {
return Text(item);
},
),
),
OptimizedButton.elevated(
child: Text('Confirm'),
onPressed: () {
showConfirmDialog(
title: 'Are you sure',
message: 'Are you sure you want to exit ?',
lottie: '',
onConfirmed: () {},
context: context,
lottieAnimationHeight: 200);
},
),
],
),
),
);
}
}