main_widgets 0.0.1 copy "main_widgets: ^0.0.1" to clipboard
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.

example/lib/main.dart

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,
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
0
points
1.06k
downloads

Publisher

verified publisherabdelrahman.ghanem.eg

Weekly Downloads

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.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_svg, lottie

More

Packages that depend on main_widgets