mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 18:08:55 +03:30
Set some save button progress bar and toast message
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ItemAddSaveButton extends StatelessWidget {
|
||||
const ItemAddSaveButton({
|
||||
@@ -11,32 +13,41 @@ class ItemAddSaveButton extends StatelessWidget {
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kBlue, kBlueSub],
|
||||
return Consumer<ItemProvider>(builder: (context, itemProvider, _) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Save',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kBlue, kBlueSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: itemProvider.isloadingButton
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Save',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user