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
setBadgeNum(int count, BuildContext context) async { | |
try { | |
await FlutterDynamicIcon.setApplicationIconBadgeNumber(count); | |
} on PlatformException { | |
print('Exception: Platform not supported'); | |
} catch (e) { | |
print(e); | |
} | |
// To get currently badge number that was set. | |
int badgeNumber = await FlutterDynamicIcon.getApplicationIconBadgeNumber(); |
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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: buildAppBar(appBarTitle: title), | |
body: Center( | |
child: ElevatedButton( | |
style: getBtnStyle(context), | |
child: const Text('Set badge no'), | |
onPressed: () => setBadgeNum(5, context), | |
), |
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
changeAppIcon() async { | |
try { | |
if (await FlutterDynamicIcon.supportsAlternateIcons) { | |
await FlutterDynamicIcon.setAlternateIconName(iconName[iconIndex]); | |
debugPrint("App icon change successful"); | |
return; | |
} | |
} catch (e) { | |
debugPrint("Exception: ${e.toString()}"); | |
} |
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
import 'package:flutter/material.dart'; | |
class MyHomePage extends StatefulWidget { | |
const MyHomePage({Key? key, required this.title}) : super(key: key); | |
final String title; | |
@override | |
State<MyHomePage> createState() => _MyHomePageState(); | |
} |
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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ |
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
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: Text(widget.title)), | |
body: Container(), | |
floatingActionButtonLocation: ExpandableFloatLocation(), | |
floatingActionButton: ExpandableDraggableFab( | |
childrenBoxDecoration: const BoxDecoration(color: Colors.transparent), | |
childrenCount: 4, |
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
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: Text(widget.title)), | |
body: Container(), | |
floatingActionButton: ExpandableDraggableFab( | |
childrenCount: 1, | |
distance: 10, | |
children: [ |
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
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: Text(widget.title)), | |
body: Container(), | |
); | |
} | |
} |
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
showDialogBox() => showCupertinoDialog<String>( | |
context: context, | |
builder: (BuildContext context) => CupertinoAlertDialog( | |
title: const Text('No Connection'), | |
content: const Text('Please check your internet connectivity'), | |
actions: <Widget>[ | |
TextButton( | |
onPressed: () async { | |
Navigator.pop(context, 'Cancel'); | |
setState(() => isAlertSet = false); |
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
late StreamSubscription subscription; | |
bool isDeviceConnected = false; | |
bool isAlertSet = false; | |
@override | |
void initState() { | |
getConnectivity(); | |
super.initState(); | |
} |