function invokeServiceWorkerUpdateFlow() {
// you have a better UI here, reloading is not a great user experince here.
const confirmed = confirm('New version of the app is available. Refresh now');
if (confirmed) {
window.location.reload();
}
}
async function handleServiceWorker() {
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'; | |
import 'package:get/get.dart'; | |
void main() { | |
runApp(GetMaterialApp( | |
debugShowCheckedModeBanner: false, | |
initialRoute: '/home', | |
defaultTransition: Transition.fade, | |
getPages: [ | |
GetPage( |
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'; | |
import 'package:get/get.dart'; | |
class GlobalMiddleware extends GetMiddleware { | |
final authController = Get.find<AuthController>(); | |
@override | |
RouteSettings redirect(String route) { | |
return authController.authenticated || route == '/login' | |
? null |
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'; | |
import 'package:get/get.dart'; | |
void main() { | |
runApp(GetMaterialApp( | |
initialRoute: '/home', | |
getPages: [ | |
GetPage( | |
name: '/home', | |
page: () => HomePage(), |
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'; | |
import 'package:get/get.dart'; | |
void main() { | |
runApp(GetMaterialApp( | |
debugShowCheckedModeBanner: false, | |
initialRoute: '/home', | |
defaultTransition: Transition.fade, | |
getPages: [ | |
GetPage( |
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'; | |
import 'package:get/get.dart'; | |
void main() { | |
runApp(GetMaterialApp( | |
initialRoute: '/home', | |
getPages: [ | |
GetPage( | |
name: '/home', | |
page: () => HomePage(), |
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'; | |
void main() => runApp(NeumorphicApp()); | |
class NeumorphicApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Neumorphic App', | |
theme: ThemeData( |
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 DetectiPhoneXOrGreater { | |
static bool isiPhoneXOrGreater(context) { | |
if (Platform.isAndroid) { | |
return false; | |
} | |
else if (Platform.isIOS) { | |
double height = MediaQuery.of(context).size.height; | |
if (height >= 812.0) return true; | |
} | |
return 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
void _onShareReceipt(context) async { | |
final data = await _onCaptureReceipt(); | |
// Utilizando o pacote "esys_flutter_share" para compartilhamento da imagem gerada | |
await Share.file('Comprovante de Venda', 'comprovante.png', data, 'image/png'); | |
} | |
Future<Uint8List> _onCaptureReceipt() async { | |
// _receiptKey é uma GlobalKey que foi atribuida ao Widget pelo qual desejo imprimir | |
RenderRepaintBoundary boundary = _receiptKey.currentContext.findRenderObject(); |
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 'dart:async'; | |
import 'dart:typed_data'; | |
import 'dart:ui' as ui; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
void main() { | |
runApp( | |
MaterialApp( |
NewerOlder