首先,您需要Info.plist使用 Flutter 参数更新扩展文件: \n <key>CFBundleShortVersionString</key>\n<string>$(FLUTTER_BUILD_NAME)</string>\n<key>CFBundleVersion</key>\n<string>$(FLUTTER_BUILD_NUMBER)</string>\n Run Code Online (Sandbox Code Playgroud)\n 现在您需要为小部件提供这些 Flutter 参数。
今天写一个简单的自定义控件,实现宽固定,高度根据自定义宽高比例自动调整;或高固定,宽度随比例调整。
import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const MaterialApp...
#ifdef FLUTTER_BUILD_NUMBER #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER #else #define VERSION_AS_NUMBER 1,1,1,2 #endif #ifdef FLUTTER_BUILD_NAME #define VERSION_AS_STRING #FLUTTER_BUILD_NAME #else #define VERSION_AS_STRING "1.1.1.2" #endif ...