updatify_flutter 1.0.1
updatify_flutter: ^1.0.1 copied to clipboard
A Flutter widget for displaying release notes, product updates, and announcements from the Updatify service.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:updatify_flutter/updatify_flutter.dart';
void main() {
runApp(const App());
}
class App extends StatefulWidget {
const App({super.key});
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
ThemeMode _themeMode = ThemeMode.light;
void _toggleTheme() {
setState(() {
_themeMode =
_themeMode == ThemeMode.light ? ThemeMode.dark : ThemeMode.light;
});
}
Future<void> _onShowDialog(BuildContext context) => showUpdatifyDialog(
context,
projectId: '3593f6b9-92de-4b32-941f-e152062745bb',
itemDecoration: UpdatifyPostDecoration(),
borderRadius: BorderRadius.circular(6),
);
@override
Widget build(BuildContext context) {
final isDark = _themeMode == ThemeMode.dark;
return MaterialApp(
theme: ThemeData(brightness: Brightness.light),
darkTheme: ThemeData(brightness: Brightness.dark),
themeMode: _themeMode,
home: Scaffold(
appBar: AppBar(
title: const Text('Updatify'),
actions: [
IconButton(
tooltip: isDark ? 'Switch to light mode' : 'Switch to dark mode',
icon: Icon(isDark ? Icons.light_mode : Icons.dark_mode),
onPressed: _toggleTheme,
),
],
),
body: Center(
child: Builder(
builder: (context) => ElevatedButton(
onPressed: () => _onShowDialog(context),
child: const Text('Show release notes'),
),
),
),
),
);
}
}