基础组件库
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

57 Zeilen
1.4 KiB

  1. import 'package:flutter/material.dart';
  2. import 'dart:async';
  3. import 'package:flutter/services.dart';
  4. import 'package:zhiying_base_widget/zhiying_base_widget.dart';
  5. void main() => runApp(MyApp());
  6. class MyApp extends StatefulWidget {
  7. @override
  8. _MyAppState createState() => _MyAppState();
  9. }
  10. class _MyAppState extends State<MyApp> {
  11. String _platformVersion = 'Unknown';
  12. @override
  13. void initState() {
  14. super.initState();
  15. initPlatformState();
  16. }
  17. // Platform messages are asynchronous, so we initialize in an async method.
  18. Future<void> initPlatformState() async {
  19. String platformVersion;
  20. // Platform messages may fail, so we use a try/catch PlatformException.
  21. try {
  22. platformVersion = await ZhiyingBaseWidget.platformVersion;
  23. } on PlatformException {
  24. platformVersion = 'Failed to get platform version.';
  25. }
  26. // If the widget was removed from the tree while the asynchronous platform
  27. // message was in flight, we want to discard the reply rather than calling
  28. // setState to update our non-existent appearance.
  29. if (!mounted) return;
  30. setState(() {
  31. _platformVersion = platformVersion;
  32. });
  33. }
  34. @override
  35. Widget build(BuildContext context) {
  36. return MaterialApp(
  37. home: Scaffold(
  38. appBar: AppBar(
  39. title: const Text('Plugin example app'),
  40. ),
  41. body: Center(
  42. child: Text('Running on: $_platformVersion\n'),
  43. ),
  44. ),
  45. );
  46. }
  47. }