最常用的 8 種 Git Commit 類型 📜
feat:🚀 - 新增使用者可見的功能。fix:🐛 - 修復程式碼中的錯誤。docs:📚 - 文件變更(如 README、程式碼註釋)。style:✨ - 只影響程式碼格式的變更,不改變邏輯。refactor:🏗️ - 重構程式碼,不影響功能,也不修復 Bug。perf:⚡ - 效能優化。test:✅ - 新增或修改測試。chore:🛠️ - 其他維護性任務(如更新依賴、構建工具配置等),不影響生產程式碼或測試。
feat: 🚀 - 新增使用者可見的功能。fix: 🐛 - 修復程式碼中的錯誤。docs: 📚 - 文件變更(如 README、程式碼註釋)。style: ✨ - 只影響程式碼格式的變更,不改變邏輯。refactor: 🏗️ - 重構程式碼,不影響功能,也不修復 Bug。perf: ⚡ - 效能優化。test: ✅ - 新增或修改測試。chore: 🛠️ - 其他維護性任務(如更新依賴、構建工具配置等),不影響生產程式碼或測試。Navigator.of(context).popUntil((route) {
// Check if the current route is NOT a DialogRoute.
// This means we stop popping when we hit a regular page/widget route.
return route is! DialogRoute;
});
1- Generate and get .jks from android studio.
2- Create a key.properties under android file as following format.
storePassword=
keyPassword=
keyAlias=
storeFile= //file path of jks3- Go to your app level build gradle and get key.properties with following code.
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}4- Add signing configurations inside the android tag.
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}5- Make sure about your signingConfig is release as following ;
buildTypes {
release {
signingConfig signingConfigs.release
}
}6- Run ‘flutter build appbundle’ command .
class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance!.addObserver(this);
}
// ...
@override
void dispose() {
WidgetsBinding.instance!.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);
print('AppLifecycleState: $state');
if (state == AppLifecycleState.resumed) {
// User has returned to the app (app is in the foreground and active)
print('myState: User returned to the app!');
// Perform actions here, e.g., refresh data, show a message, etc.
} else if (state == AppLifecycleState.paused) {
// App is in the background
print('myState: App went to background');
} else if (state == AppLifecycleState.inactive) {
// App is inactive (e.g., a phone call came in, or app is about to go to background)
print('myState: App is inactive');
}
}
進入debug模式進行調試發現錯誤
======== Exception caught by widgets library =======================================================
The following assertion was thrown while applying parent data.:
Incorrect use of ParentDataWidget.
The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type StackParentData.
Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets.
The offending Expanded is currently placed inside a Stack widget.
針對Exception 處理問題
android > gradle > wrapper > gradle-wrapper.properties
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip