Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
vijaycreations

Vijay R vijayinyoutube

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