jars 0.0.6 jars: ^0.0.6 copied to clipboard
JARS is a super-effective and lightweight solution for Flutter.
import 'package:example/demos/export.dart';
import 'package:example/demos/jdialogs.dart';
import 'package:jars/jars.dart';
import 'package:flutter/material.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const AppRun());
}
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
class AppRun extends StatelessWidget {
const AppRun({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
navigatorKey: navigatorKey,
initialRoute: '/JDialogsDemo',
routes: {
'/HomePage': (context) => const HomePage(),
'/JMarqueeDemo': (context) => const JMarqueeDemo(),
'/RToastandRSnakBarDemo': (context) => const RToastandRSnakBarDemo(),
'/JTextPlusDemo': (context) => const JTextPlusDemo(),
'/JDialogsDemo': (context) => const JDialogsDemo(),
},
themeMode: ThemeMode.dark,
darkTheme: ThemeData.dark(useMaterial3: true),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
JTextPlus(
'Welcome in <r>JARS ❤️</r> Demo\n<s>developed by @rahulsharmadev</s>',
jTextStyles: [
JTextStyle('r',
color: Colors.red.shade400,
fontWeight: FontWeight.bold),
JTextStyle('s', fontSize: 12.dp)
],
textAlign: TextAlign.center,
style: TextStyle(fontSize: 24.dp, color: Colors.white))
.opacity(10),
const SizedBox(height: 64),
...{
'/JMarqueeDemo': 'JMarquee Demo',
'/RToastandRSnakBarDemo': 'RToast & RSnakBar Demo',
'/JTextPlusDemo': 'JTextPlus Demo',
}
.entries
.map((e) => TextButton(
onPressed: () =>
navigatorKey.currentState?.pushNamed(e.key),
child: Text(e.value),
))
.toList()
],
),
),
);
}
}