doc : CoreLoadingIndicator and CoreLoadingOverlay
This commit is contained in:
BIN
doc/CoreLoadingIndicator.png
Normal file
BIN
doc/CoreLoadingIndicator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 84 KiB |
@@ -25,12 +25,32 @@ class HomePage extends GetView<HomeLogic> {
|
||||
SizedBox(height: 8.h),
|
||||
WidelyUsedWidget(),
|
||||
SizedBox(height: 20),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
children: [
|
||||
buildColumn(CoreLoadingIndicator(), 'CoreLoadingIndicator'),
|
||||
buildColumn(CoreLoadingIndicator.linear(), 'CoreLoadingIndicator.linear'),
|
||||
buildColumn(CoreLoadingIndicator.lottie(), ' CoreLoadingIndicator.lottie'),
|
||||
buildColumn(CoreLoadingIndicator.small(), ' CoreLoadingIndicator.small'),
|
||||
|
||||
buildColumn(CoreLoadingIndicator.cupertino(), 'CoreLoadingIndicator.cupertino'),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildColumn(Widget widget, String title) {
|
||||
|
||||
return Container(
|
||||
height: 70.h,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 8, children: [widget, Text(title)]));
|
||||
}
|
||||
|
||||
InkWell mainInformation() {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
|
||||
class BasePage extends GetView<BaseLogic> {
|
||||
const BasePage({
|
||||
super.key,
|
||||
|
||||
@@ -2,14 +2,68 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
///Documentation
|
||||
/// A unified loading indicator widget with multiple variants and customization options
|
||||
/// This widget provides consistent loading states across the entire app with
|
||||
/// support for different variants, sizes, colors, and text labels.
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// CoreLoadingIndicator(
|
||||
/// variant: CoreLoadingVariant.material,
|
||||
/// size: CoreLoadingSize.medium,
|
||||
/// color: Colors.blue,
|
||||
/// label: 'Loading...',
|
||||
/// )
|
||||
/// ```
|
||||
/// or use predefined constructors:
|
||||
/// ```dart
|
||||
/// CoreLoadingIndicator.small(color: Colors.red)
|
||||
/// CoreLoadingIndicator.cupertino(size: CoreLoadingSize.large)
|
||||
/// CoreLoadingIndicator.linear(value: 0.5)
|
||||
/// CoreLoadingIndicator.lottie(size: CoreLoadingSize.extraLarge, label: 'Please wait')
|
||||
/// ```
|
||||
/// or show a full-screen overlay:
|
||||
/// ```dart
|
||||
/// CoreLoadingOverlay.show(context)
|
||||
/// ```
|
||||
/// or hide the overlay:
|
||||
/// ```dart
|
||||
/// CoreLoadingOverlay.hide(context)
|
||||
/// ```
|
||||
/// Parameters:
|
||||
/// - variant: The type of loading indicator (material, cupertino, linear, lottie
|
||||
/// - size: Preset sizes (small, medium, large, extraLarge)
|
||||
/// - width, height: Custom dimensions (overrides size preset)
|
||||
/// - color: Color of the indicator
|
||||
/// - value: Progress value for determinate indicators (0.0 to 1.0
|
||||
/// - strokeWidth: Stroke width for circular indicators
|
||||
/// - label: Optional text label below the indicator
|
||||
/// - labelStyle: Text style for the label
|
||||
/// - labelSpacing: Spacing between indicator and label
|
||||
/// - labelAlignment: Alignment of the label relative to the indicator
|
||||
/// - backgroundColor: Background color for overlay
|
||||
/// - barrierDismissible: Whether the overlay blocks user interaction
|
||||
/// Note: Requires `lottie` package for Lottie animations
|
||||
/// Example Lottie asset can be found in `assets/animations/loading.json`
|
||||
/// Make sure to add it to your pubspec.yaml
|
||||
/// ```yaml
|
||||
/// assets:
|
||||
/// - assets/animations/loading.json
|
||||
/// ```
|
||||
/// see widget in this link:
|
||||
/// https://github.com/mirani95/rasadyarApp/blob/develop/doc/CoreLoadingIndicator.png
|
||||
|
||||
/// Loading indicator variant types
|
||||
enum CoreLoadingVariant {
|
||||
/// Material Design circular progress indicator
|
||||
material,
|
||||
|
||||
/// iOS style activity indicator
|
||||
cupertino,
|
||||
|
||||
/// Custom Lottie animation
|
||||
lottie,
|
||||
|
||||
/// Linear progress indicator
|
||||
linear,
|
||||
}
|
||||
@@ -18,10 +72,13 @@ enum CoreLoadingVariant {
|
||||
enum CoreLoadingSize {
|
||||
/// Small - 16x16
|
||||
small,
|
||||
|
||||
/// Medium - 24x24 (default)
|
||||
medium,
|
||||
|
||||
/// Large - 32x32
|
||||
large,
|
||||
|
||||
/// Extra large - 48x48
|
||||
extraLarge,
|
||||
}
|
||||
@@ -223,9 +280,7 @@ class CoreLoadingIndicator extends StatelessWidget {
|
||||
|
||||
return Text(
|
||||
label!,
|
||||
style: labelStyle ?? AppFonts.yekan14.copyWith(
|
||||
color: AppColor.textColor,
|
||||
),
|
||||
style: labelStyle ?? AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
textAlign: TextAlign.center,
|
||||
);
|
||||
}
|
||||
@@ -276,9 +331,7 @@ class CoreLoadingOverlay extends StatelessWidget {
|
||||
|
||||
const CoreLoadingOverlay({
|
||||
super.key,
|
||||
this.indicator = const CoreLoadingIndicator.lottie(
|
||||
label: 'در حال بارگذاری...',
|
||||
),
|
||||
this.indicator = const CoreLoadingIndicator.lottie(label: 'در حال بارگذاری...'),
|
||||
this.backgroundColor = Colors.black54,
|
||||
this.barrierDismissible = false,
|
||||
});
|
||||
@@ -303,9 +356,7 @@ class CoreLoadingOverlay extends StatelessWidget {
|
||||
barrierDismissible: barrierDismissible,
|
||||
barrierColor: Colors.transparent,
|
||||
builder: (context) => CoreLoadingOverlay(
|
||||
indicator: indicator ?? const CoreLoadingIndicator.lottie(
|
||||
label: 'در حال بارگذاری...',
|
||||
),
|
||||
indicator: indicator ?? const CoreLoadingIndicator.lottie(label: 'در حال بارگذاری...'),
|
||||
backgroundColor: backgroundColor,
|
||||
barrierDismissible: barrierDismissible,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user