v1.0.3loading_btn
一個動畫加載按鈕套件,可讓您創建具有多種自定義屬性的美觀加載按鈕。
一個在 Flutter 中的動畫載入按鈕套件
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0以下為英文專案原文快照,最新內容請造訪 GitHub。
Create animated loading button using loading_btn package with lots of properties.
Loading Btn package helps you create beautiful loading animation in your buttons with customized loader. Loading Btn is basically an ElevatedButton widget that means you can use the usual parameters with a few extra functionalities.
LoadingBtn(
height: 50,
borderRadius: 8,
animate: true,
color: Colors.green,
width: MediaQuery.of(context).size.width * 0.45,
loader: Container(
padding: const EdgeInsets.all(10),
width: 40,
height: 40,
child: const CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
),
),
child: const Text("Login"),
onTap: (startLoading, stopLoading, btnState) async {
if (btnState == ButtonState.idle) {
startLoading();
// call your network api
await Future.delayed(const Duration(seconds: 5));
stopLoading();
}
},
),
LoadingBtn(
height: 50,
borderRadius: 8,
roundLoadingShape: false,
color: Colors.blueAccent,
width: MediaQuery.of(context).size.width * 0.45,
minWidth: MediaQuery.of(context).size.width * 0.30,
loader: const Text("Loading..."),
child: const Text("Login"),
onTap: (startLoading, stopLoading, btnState) async {
if (btnState == ButtonState.idle) {
startLoading();
// call your network api
await Future.delayed(const Duration(seconds: 5));
stopLoading();
}
},
),
LoadingBtn(
height: 50,
borderRadius: 8,
animate: true,
color: Colors.deepOrange,
width: MediaQuery.of(context).size.width * 0.45,
loader: Container(
padding: const EdgeInsets.all(10),
child: const Center(
child: SpinKitDoubleBounce(
color: Colors.white,
),
),
),
child: const Text("Login"),
onTap: (startLoading, stopLoading, btnState) async {
if (btnState == ButtonState.idle) {
startLoading();
// call your network api
await Future.delayed(const Duration(seconds: 5));
stopLoading();
}
},
),
Copyright (c) 2022 Yasin Mohammadi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.