custom_loading 1.0.1 custom_loading: ^1.0.1 copied to clipboard
Introducing custom_loading A Flutter package for seamless loading screens. Easily customize and integrate loading animations into your app.
import 'package:custom_loading/custom_loading.dart';
import 'package:flutter/material.dart';
import 'package:loading_animation_widget/loading_animation_widget.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: 'Custom Loading Scaffold Example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Custom Loading Scaffold Example'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool isLoading = false;
@override
Widget build(BuildContext context) {
return CustomLoadingScaffold(
isLoading: isLoading,
blurIntensity: 2.0,
loaderWidget: LoadingAnimationWidget.staggeredDotsWave(
color: Colors.deepPurple,
size: 80,
),
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title,
style: const TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w500)),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
"Press Below Button To Start Loading",
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w500),
),
const SizedBox(
height: 20,
),
InkWell(
onTap: () {
setState(() {
isLoading = true;
});
Future.delayed(const Duration(seconds: 5), () {
setState(() {
isLoading = false;
});
});
},
child: Container(
height: 60,
width: 180,
decoration: BoxDecoration(
color: Colors.deepPurple,
borderRadius: BorderRadius.circular(20)),
child: const Center(
child: Text(
"Show Loading",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600),
)),
),
)
],
),
),
);
}
}