szhassistant 0.1.0 szhassistant: ^0.1.0 copied to clipboard
szh Assistant is used to facilitate the creation of applications and contains some basic things in each application, such as the appbar and dialog, the most used text sizes and the most used colors, a [...]
import 'package:flutter/material.dart';
import 'package:szhassistant/router/routers.dart';
import 'package:szhassistant/runMain/conf.dart';
import 'package:szhassistant/theme/colors.dart';
import 'package:szhassistant/theme/textsize.dart';
import 'package:szhassistant/tools/SizeConfig.dart';
import 'package:szhassistant/tools/size.dart';
import 'package:szhassistant/widget/mybar.dart';
import 'package:szhassistant/widget/showdialog.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
Routes routes = Routes();
routes.addRoute('/', const Home());
myConf(color: black, backgroundColor: white);
return myMaterialApp(const Home(), "My Example");
}
}
class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return Scaffold(
appBar: myAppBar(context,
color: black,
title: "My Example",
disableTitle: false,
centerTitle: false,
height: 0.2,
leading: const Icon(Icons.home),
rtl: false,
disableActions: true,
space: Container(
padding: EdgeInsets.all(getSize(context, 0.01)),
alignment: Alignment.center,
margin: EdgeInsets.only(
top: getSizeHeight(context, 0.1),
bottom: getSizeHeight(context, 0.01),
right: getSizeHeight(context, 0.01),
left: getSizeHeight(context, 0.01)),
decoration: BoxDecoration(
color: gray,
borderRadius: BorderRadius.all(
Radius.circular(getSize(context, 0.02)))),
height: getSizeHeight(context, 0.2),
child: Text(
"App Bar Body Here",
style: TextStyle(
color: white,
fontSize: SizeConfig.safeBlockVertical * textSize2_5),
),
),
elevation: 0,
topRight: 0,
topLeft: 0,
bottomLeft: getSize(context, 0.02),
bottomRight: getSize(context, 0.02)),
body: Center(
child: ElevatedButton(
onPressed: () {
showMyDialog(context,
title: const Text("Title Here:"),
children: const Column(children: [
Text("Children Here"),
]),
isPreventClose: false);
},
style: ElevatedButton.styleFrom(backgroundColor: black),
child: const Text("Show Dailog"),
),
));
}
}