Flutter :: Package Info for About us
import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:package_info/package_info.dart'; class AboutScreen extends StatefulWidget { static String routeName = "/about"; @override _AboutScreenState createState() => _AboutScreenState(); } class _AboutScreenState extends State<AboutScreen> { PackageInfo _packageInfo = PackageInfo( appName: 'Unknown', packageName: 'Unknown', version: 'Unknown', buildNumber: 'Unknown', ); //SharedPreferences.setMockInitialValues({}); @override initState() { super.initState(); _initPackageInfo(); } Future<void> _initPackageInfo() async { final PackageInfo info = await PackageInfo.fromPlatform(); log(info.toString()); setState(() { _packageInfo = info; }); } Widget _infoTile(String title, String subtitle) { return ListTile( title: Text(title), subtitle: Text(subtitle.isNotEmpty ? subtitle : 'Not set'), ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( // title: Text(widget.title), title: Text('About us'), ), body: Column( // mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ _infoTile('App name', _packageInfo.appName), _infoTile('Package name', _packageInfo.packageName), _infoTile('App version', _packageInfo.version), _infoTile('Build number', _packageInfo.buildNumber), ], ), ); } }
ที่มา
Relate topics
- My app on macOS - ใช้แอบอะไรบ้างนะบน macOS
- macOS/Flutter : Exception: Error running pod install
- Build App & Upload to store
- ทำแอปหลายภาษา
- Flutter Permission
- Flutter App Lifecycle
- My First Flutter App
- Run Flutter บน iPad
- Application Green Smile
- Affinity Photo for desktop or Clip Studio Paint ?
- Android : Input type="file" ไม่ทำงานบน webView
- แค่นี้ก็เต็มจอ
- W3C ออกมาตรฐานการสร้าง Mobile Web Apps
- IP convert
- โปรแกรมสำหรับแพทย์บน Android