with_loader 0.0.2
SDKflutter
Platformandroidioswindowslinuxmacosweb
A Flutter package that provides loading functionality to a widget.
With Loader
A Flutter package that provides loading functionality to a widget. Just Warp your widget with WithLoader and give all the necessary parameters.
Features
- Can be helpful when you need a
Futurefunction to be performedonTapof a Button. - You can customise the
childopacity while it is in loading state. - It exposes the result of the
Futurefunction, through which you can decide thesuccessorfailurecondition of that function. - According to this
successConditionit will performonSuccessoronFailure.
Getting started
Add with_loader to pubspec.yaml of your project:
dependencies:
with_loader: ^0.0.1
Import it in your Dart code:
import 'package:with_loader/with_loader.dart';
Usage
Wrap any widget with WithLoader<T>():
WithLoader<Type>(
child: AnyWidget()
),
Some required parameters to make this widget work:
WithLoader<String>(
future: () => Future.delayed(const Duration(seconds: 2), () => "Success"),
successCondition: (result) => result == "Success",
child: Container(
decoration: BoxDecoration(
color: Colors.purple.shade400,
borderRadius: BorderRadius.circular(50),
),
child: const Padding(
padding: EdgeInsets.symmetric(
horizontal: 32.0,
vertical: 16.0,
),
child: Text(
"Button",
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
),
),