main_widgets 0.0.1 main_widgets: ^0.0.1 copied to clipboard
The MainScreen widget efficiently manages loading, empty, and data display states, with built-in refresh functionality. It simplifies state handling and reduces boilerplate code in Flutter apps.
import 'package:flutter/material.dart';
import 'package:main_widgets/main_widgets.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('home'),
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'You have pushed the button this many times:',
),
MainLoadingWidget(
path: 'assets/animation.gif',
// path: 'assets/Animation0.json',
type: LoadingType.gif,
),
],
),
),
);
}
}