custom_upgrader 3.6.0 copy "custom_upgrader: ^3.6.0" to clipboard
custom_upgrader: ^3.6.0 copied to clipboard

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

example/lib/main.dart

/*
 * Copyright (c) 2019 Larry Aasen. All rights reserved.
 */

import 'package:custom_upgrader/custom_upgrader.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  MyApp({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Only call clearSavedSettings() during testing to reset internal values.
    Upgrader().clearSavedSettings(); // REMOVE this for release builds

    // On Android, the default behavior will be to use the Google Play Store
    // version of the app.
    // On iOS, the default behavior will be to use the App Store version of
    // the app, so update the Bundle Identifier in example/ios/Runner with a
    // valid identifier already in the App Store.

    return MaterialApp(
      title: 'Upgrader Example',
      home: Scaffold(
          appBar: AppBar(
            title: Text('Upgrader Example'),
          ),
          body: UpgradeAlert(
            debugLogging: true,
            child: Center(child: Text('Checking...')),
            getCustomDialog: getCustomDialog,
          )),
    );
  }
}

/// Example Custom Dialog Widget
Widget getCustomDialog(BuildContext context,
    {String title,
    String message,
    String releaseNotes,
    void Function() onUserIgnored,
    void Function() onUserLater,
    void Function() onUserUpdated}) {
  return Center(
    child: Container(
      height: 124,
      width: MediaQuery.of(context).size.width * 0.8,
      color: Colors.white,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Text(
            'Your Custom Upgrader Dialog',
          ),
          Row(
            mainAxisSize: MainAxisSize.min,
            children: [
              TextButton(onPressed: onUserIgnored, child: Text('IGNORE')),
              TextButton(onPressed: onUserLater, child: Text('LATER')),
              TextButton(
                onPressed: onUserUpdated,
                child: Text(
                  'UPDATE',
                  style: TextStyle(
                    color: Colors.black,
                  ),
                ),
              ),
            ],
          ),
        ],
      ),
    ),
  );
}
16
likes
70
pub points
16%
popularity

Publisher

unverified uploader

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

device_info, flutter, html, http, package_info, shared_preferences, url_launcher, version, xml

More

Packages that depend on custom_upgrader