Starlight NetChecker 组件

Starlight NetChecker 组件是一个典型的用于检查您的互联网连接的组件。

特点

名称 状态
动画互联网连接检查器组件
Connectivity Plus

截图

        

安装

将 starlight_netchecker_widget 添加到您的 pubspec 文件中作为依赖项。

   starlight_netchecker_widget: 
    git:
      url: https://github.com/YeMyoAung/starlight_netchecker_widget.git

设置

Android 和 iOS 不需要额外的集成步骤。

用法

首先,您需要导入我们的包。

import 'package:starlight_netchecker_widget/starlight_netchecker_widget.dart';

然后您就可以轻松使用了。

属性

  ///The widget which will show in your main ui 
  final Widget child;
  
  ///Position of indicator widget
  final StarlightNetCheckerPosition position;
  
  ///Height of indicator widget
  final double indicatorHeight;
  
  ///Color of indicator
  final Color indicatorColor, errorIndicatorColor;
  
  ///label of indicator
  final String label, errorLabel;
  
  ///Duration of indicator animation
  final Duration duration;
  
  ///The widget which will show in your indicator ui
  final Widget? customIndicator;

示例

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return StarlightNetChecker(
      position: StarlightNetCheckerPosition.bottom,
      indicatorHeight: 50,
      indicatorColor: Colors.green,
      errorIndicatorColor: Colors.red,
      label: "Connected",
      errorLabel: "No Internet Connection",
      customIndicator: const Text("hello"),
      duration: const Duration(seconds: 1),
      child: Scaffold(),
    );
  }
}

联系我们

Starlight Studio

GitHub

查看 Github