Upgrader Package

125 Views Asked by At

i have a problem with implementing this package in my flutter app so i go to docs of this package they say just wrap your body with UpgradeAlert() and go ahead to publish your app and they doing every thing

`Future main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Upgrader.clearSavedSettings();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );`



`class MyApp extends StatefulWidget {
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
  AnimationController? _animationController;
  Animation<Color?> _colorAnimation = AlwaysStoppedAnimation(Colors.white);
  ThemeData? _previousTheme;
  ThemeData? _nextTheme;

  @override
  void initState() {
    super.initState();
    _animationController = AnimationController(
      duration: const Duration(seconds: 20),
      vsync: this,
    );
    _colorAnimation = AlwaysStoppedAnimation(
        Provider.of<ThemeProvider>(context, listen: false)
            .themeData
            .scaffoldBackgroundColor);
    final themeProvider = Provider.of<ThemeProvider>(context, listen: false);
    _previousTheme = themeProvider.themeData;
    _nextTheme = themeProvider.themeData;
  }

  @override
  void dispose() {
    _animationController?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final providerlang = Provider.of<LocaleProvider>(context);
    final themeProvider = Provider.of<ThemeProvider>(context);
    // final appcastURL =
    //     'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml';
    // final cfg = AppcastConfiguration(url: appcastURL, supportedOS: ['android']);

    if (_previousTheme != null &&
        _nextTheme != null &&
        (_previousTheme == null || _nextTheme != themeProvider.themeData)) {
      _previousTheme = _nextTheme;
      _nextTheme = themeProvider.themeData;
      _colorAnimation = ColorTween(
        begin: _previousTheme?.scaffoldBackgroundColor,
        end: _nextTheme?.scaffoldBackgroundColor,
      ).animate(_animationController!);
      _animationController?.forward(from: 0);
    }
    return Consumer<AuthService>(builder: (context, authService, child) {
      return Builder(
        builder: (context) {
          return AnimatedBuilder(
            animation: _colorAnimation,
            builder: (context, child) {
              return MaterialApp(
                locale: providerlang.locale,
                supportedLocales: L10n.all,
                localizationsDelegates: [
                  AppLocalizations.delegate,
                  GlobalMaterialLocalizations.delegate,
                  GlobalCupertinoLocalizations.delegate,
                  GlobalWidgetsLocalizations.delegate,
                  KurdishMaterialLocalizations.delegate,
                  KurdishWidgetLocalizations.delegate,
                  KurdishCupertinoLocalizations.delegate,
                ],
                debugShowCheckedModeBanner: false,
                theme: _nextTheme,
                home:
                 UpgradeAlert(
                   upgrader: Upgrader(),
                   child: Scaffold(
                        backgroundColor: _colorAnimation.value,
                        body: SplashScreen(),
                        ),
                 ),

` this is my code and i published now he give a Alertdialog but he write like this "A New version of app is available! version 5.0 is now available- you have 1.3.0" he say you can custom your version by write it in bottom of description like this [Minimum supported app version: 1.3.0] okay he take it but this 5.0 it is by default how can i solve it to compare with my current version correctly ?

0

There are 0 best solutions below