flutter app untuk unitstock
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

102 linhas
2.6 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:location/location.dart';
  3. import 'package:url_launcher/url_launcher.dart';
  4. import 'get_location.dart';
  5. import 'listen_location.dart';
  6. import 'permission_status.dart';
  7. import 'service_enabled.dart';
  8. void main() => runApp(MyApp());
  9. class MyApp extends StatelessWidget {
  10. // This widget is the root of your application.
  11. @override
  12. Widget build(BuildContext context) {
  13. return MaterialApp(
  14. title: 'Flutter Location',
  15. theme: ThemeData(
  16. primarySwatch: Colors.amber,
  17. ),
  18. home: const MyHomePage(title: 'Flutter Location Demo'),
  19. );
  20. }
  21. }
  22. class MyHomePage extends StatefulWidget {
  23. const MyHomePage({Key key, this.title}) : super(key: key);
  24. final String title;
  25. @override
  26. _MyHomePageState createState() => _MyHomePageState();
  27. }
  28. class _MyHomePageState extends State<MyHomePage> {
  29. final Location location = Location();
  30. Future<void> _showInfoDialog() {
  31. return showDialog<void>(
  32. context: context,
  33. builder: (BuildContext context) {
  34. return AlertDialog(
  35. title: const Text('Demo Application'),
  36. content: SingleChildScrollView(
  37. child: ListBody(
  38. children: <Widget>[
  39. const Text('Created by Guillaume Bernos'),
  40. InkWell(
  41. child: Text(
  42. 'https://github.com/Lyokone/flutterlocation',
  43. style: TextStyle(
  44. decoration: TextDecoration.underline,
  45. ),
  46. ),
  47. onTap: () =>
  48. launch('https://github.com/Lyokone/flutterlocation'),
  49. ),
  50. ],
  51. ),
  52. ),
  53. actions: <Widget>[
  54. FlatButton(
  55. child: const Text('Ok'),
  56. onPressed: () {
  57. Navigator.of(context).pop();
  58. },
  59. ),
  60. ],
  61. );
  62. },
  63. );
  64. }
  65. @override
  66. Widget build(BuildContext context) {
  67. return Scaffold(
  68. appBar: AppBar(
  69. title: Text(widget.title),
  70. actions: <Widget>[
  71. IconButton(
  72. icon: Icon(Icons.info_outline),
  73. onPressed: _showInfoDialog,
  74. )
  75. ],
  76. ),
  77. body: Container(
  78. padding: const EdgeInsets.all(32),
  79. child: Column(
  80. children: const <Widget>[
  81. PermissionStatusWidget(),
  82. Divider(height: 32),
  83. ServiceEnabledWidget(),
  84. Divider(height: 32),
  85. GetLocationWidget(),
  86. Divider(height: 32),
  87. ListenLocationWidget()
  88. ],
  89. ),
  90. ),
  91. );
  92. }
  93. }