Skip to content

Instantly share code, notes, and snippets.

View vijayinyoutube's full-sized avatar
👋
vijaycreations

Vijay R vijayinyoutube

👋
vijaycreations
View GitHub Profile
@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),
),
changeAppIcon() async {
try {
if (await FlutterDynamicIcon.supportsAlternateIcons) {
await FlutterDynamicIcon.setAlternateIconName(iconName[iconIndex]);
debugPrint("App icon change successful");
return;
}
} catch (e) {
debugPrint("Exception: ${e.toString()}");
}
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();
}
@vijayinyoutube
vijayinyoutube / home_page.dart
Created September 5, 2022 08:12
Simple home page file containing navigation btns for first and second page
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
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,
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: [
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Container(),
);
}
}
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);
late StreamSubscription subscription;
bool isDeviceConnected = false;
bool isAlertSet = false;
@override
void initState() {
getConnectivity();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Connectivity Checker'),
),
body: Center(
child: ElevatedButton(
onPressed: () => Navigator.push(
context,