-
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #369 from larryaasen/custom
Moved UI related code outside of Upgrader and into UpgradeAlert and UpgradeCard.
- Loading branch information
Showing
34 changed files
with
1,636 additions
and
894 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2023 Larry Aasen. All rights reserved. | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:upgrader/upgrader.dart'; | ||
|
||
void main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
|
||
// Only call clearSavedSettings() during testing to reset internal values. | ||
await 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. | ||
runApp(MyApp()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
MyApp({super.key}); | ||
|
||
final dark = ThemeData.dark(useMaterial3: true); | ||
|
||
final light = ThemeData( | ||
dialogTheme: DialogTheme( | ||
titleTextStyle: TextStyle(color: Colors.red, fontSize: 48), | ||
contentTextStyle: TextStyle(color: Colors.green, fontSize: 18), | ||
), | ||
// Change the text buttons. | ||
textButtonTheme: const TextButtonThemeData( | ||
style: ButtonStyle( | ||
// Change the color of the text buttons. | ||
foregroundColor: MaterialStatePropertyAll(Colors.orange), | ||
), | ||
), | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Upgrader Example', | ||
home: UpgradeAlert( | ||
child: Scaffold( | ||
appBar: AppBar(title: Text('Upgrader Alert Theme Example')), | ||
body: Center(child: Text('Checking...')), | ||
)), | ||
theme: light, | ||
darkTheme: dark, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright (c) 2023 Larry Aasen. All rights reserved. | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:upgrader/upgrader.dart'; | ||
|
||
void main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
|
||
// Only call clearSavedSettings() during testing to reset internal values. | ||
await 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. | ||
runApp(MyApp()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
MyApp({super.key}); | ||
|
||
final dark = ThemeData.dark(useMaterial3: true); | ||
|
||
final light = ThemeData( | ||
cardTheme: CardTheme(color: Colors.greenAccent), | ||
// Change the text buttons. | ||
textButtonTheme: const TextButtonThemeData( | ||
style: ButtonStyle( | ||
// Change the color of the text buttons. | ||
foregroundColor: MaterialStatePropertyAll(Colors.orange), | ||
), | ||
), | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Upgrader Card Example', | ||
home: Scaffold( | ||
appBar: AppBar(title: Text('Upgrader Card Theme Example')), | ||
body: Container( | ||
margin: EdgeInsets.only(left: 12.0, right: 12.0), | ||
child: SingleChildScrollView( | ||
child: Column( | ||
children: [ | ||
_simpleCard, | ||
_simpleCard, | ||
UpgradeCard(), | ||
_simpleCard, | ||
_simpleCard, | ||
], | ||
), | ||
), | ||
), | ||
), | ||
theme: light, | ||
darkTheme: dark, | ||
); | ||
} | ||
|
||
Widget get _simpleCard => Card( | ||
child: SizedBox( | ||
width: 200, | ||
height: 50, | ||
child: Center(child: Text('Card')), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.