main.dart 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import 'package:flutter/foundation.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_spinkit/flutter_spinkit.dart';
  4. import 'package:native_vision_example/doc_scan_page.dart';
  5. import 'package:native_vision_example/loading_overlay.dart';
  6. void main() {
  7. if (kReleaseMode) {
  8. debugPrint = (String? message, {int? wrapWidth}) {};
  9. }
  10. runApp(const MyApp());
  11. }
  12. class MyApp extends StatefulWidget {
  13. const MyApp({Key? key}) : super(key: key);
  14. @override
  15. State<MyApp> createState() => _MyAppState();
  16. }
  17. class _MyAppState extends State<MyApp> {
  18. @override
  19. void initState() {
  20. super.initState();
  21. }
  22. @override
  23. Widget build(BuildContext context) {
  24. return const MaterialApp(
  25. home: HomePage(),
  26. );
  27. }
  28. }
  29. class HomePage extends StatefulWidget {
  30. const HomePage({Key? key}) : super(key: key);
  31. @override
  32. State<StatefulWidget> createState() {
  33. return HomePageState();
  34. }
  35. }
  36. class HomePageState extends State {
  37. @override
  38. Widget build(BuildContext context) {
  39. return Scaffold(
  40. appBar: AppBar(
  41. title: const Text("首页"),
  42. ),
  43. body: Center(
  44. child: TextButton(
  45. style: TextButton.styleFrom(backgroundColor: Colors.blueAccent),
  46. onPressed: () {
  47. Navigator.push(
  48. context,
  49. MaterialPageRoute(
  50. builder: (context) =>
  51. const LoadingOverlay(child: DocScanPage())),
  52. );
  53. },
  54. child: const Text(
  55. "文档实时扫描",
  56. style: TextStyle(fontSize: 24, color: Colors.yellow),
  57. ),
  58. )),
  59. );
  60. }
  61. }