lazyui 0.4.6 lazyui: ^0.4.6 copied to clipboard
LazyUi is a collection of widgets and utilities designed to simplify and speed up the app development process with Flutter. Simplifying Flutter development for those who prefer efficiency. Fewer lines [...]
import 'package:flutter/material.dart';
import 'package:lazyui/lazyui.dart';
import 'pages/page.dart';
import 'theme/theme.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
LazyUi.config(
radius: 5,
primaryColor: LzColors.dark,
theme: AppTheme.light,
textStyle: GoogleFonts.nunito(fontSize: 15.5),
iconType: IconType.tablerIcon,
widgets: () {
LzConfirm.config(cancel: 'Cancel', confirm: 'Yes!');
LzToast.config(position: Position.center);
// LzImage.config(errorWidget: <your widget here>);
Errors.config(
botToken: '<bot_token>',
chatId: '<chat_id>',
useBot: true,
errorBuilder: (ErrorInfo info) {
String message =
'This is custom error message: ${info.error}, ${info.device}';
Bot.sendMessage(message, info.botToken!, info.chatId!);
});
});
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "LazyUi",
theme: appTheme,
home: const HomePage(),
builder: (BuildContext context, Widget? widget) {
double fontDeviceSize = MediaQuery.of(context).textScaleFactor;
// prevent user from scaling font size
return MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: fontDeviceSize > 1.1 ? 1.1 : 1.0,
),
child: LzToastOverlay(child: widget));
},
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: AppIntro2(),
);
}
}