Code clean up

This commit is contained in:
Hillel Coren 2023-03-01 13:48:22 +02:00
parent 75eaaea15f
commit 372932fdaf
6 changed files with 0 additions and 167 deletions

View File

@ -22,7 +22,6 @@ class ViewScaffold extends StatelessWidget {
const ViewScaffold({ const ViewScaffold({
@required this.body, @required this.body,
@required this.entity, @required this.entity,
this.floatingActionButton,
this.appBarBottom, this.appBarBottom,
this.isFilter = false, this.isFilter = false,
this.onBackPressed, this.onBackPressed,
@ -34,7 +33,6 @@ class ViewScaffold extends StatelessWidget {
final BaseEntity entity; final BaseEntity entity;
final Widget body; final Widget body;
final Function onBackPressed; final Function onBackPressed;
final Widget floatingActionButton;
final Widget appBarBottom; final Widget appBarBottom;
final String title; final String title;
final bool isEditable; final bool isEditable;

View File

@ -198,98 +198,6 @@ class _ClientViewState extends State<ClientView>
], ],
); );
}), }),
floatingActionButton: FloatingActionButton(
heroTag: 'client_view_fab',
backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () {
showDialog<SimpleDialog>(
context: context,
builder: (BuildContext context) => SimpleDialog(children: <Widget>[
userCompany.canViewCreateOrEdit(EntityType.client)
? ListTile(
//dense: true,
leading: Icon(Icons.add_circle_outline),
title: Text(localization.invoice),
onTap: () {
Navigator.of(context).pop();
handleClientAction(
context, [client], EntityAction.newInvoice);
},
)
: Container(),
userCompany.canViewCreateOrEdit(EntityType.payment)
? ListTile(
//dense: true,
leading: Icon(Icons.add_circle_outline),
title: Text(localization.payment),
onTap: () {
Navigator.of(context).pop();
handleClientAction(
context, [client], EntityAction.newPayment);
},
)
: Container(),
userCompany.canViewCreateOrEdit(EntityType.quote)
? ListTile(
//dense: true,
leading: Icon(Icons.add_circle_outline),
title: Text(localization.quote),
onTap: () {
Navigator.of(context).pop();
handleClientAction(
context, [client], EntityAction.newQuote);
},
)
: Container(),
userCompany.canViewCreateOrEdit(EntityType.project)
? ListTile(
//dense: true,
leading: Icon(Icons.add_circle_outline),
title: Text(localization.project),
onTap: () {
Navigator.of(context).pop();
handleClientAction(
context, [client], EntityAction.newProject);
},
)
: Container(),
userCompany.canViewCreateOrEdit(EntityType.task)
? ListTile(
//dense: true,
leading: Icon(Icons.add_circle_outline),
title: Text(localization.task),
onTap: () {
Navigator.of(context).pop();
handleClientAction(
context, [client], EntityAction.newTask);
},
)
: Container(),
userCompany.canViewCreateOrEdit(EntityType.expense)
? ListTile(
//dense: true,
leading: Icon(Icons.add_circle_outline),
title: Text(localization.expense),
onTap: () {
Navigator.of(context).pop();
createEntity(
context: context,
entity: ExpenseEntity(
state: store.state,
client: client,
));
},
)
: Container(),
]),
);
},
child: Icon(
Icons.add,
color: Colors.white,
),
tooltip: localization.create,
),
); );
} }
} }

View File

@ -161,44 +161,6 @@ class _ExpenseViewState extends State<ExpenseView>
], ],
); );
}), }),
floatingActionButton: viewModel.state.isEnterprisePlan
? Builder(builder: (BuildContext context) {
return FloatingActionButton(
heroTag: 'expense_fab',
backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () async {
MultipartFile multipartFile;
if (kIsWeb) {
multipartFile = await pickFile();
} else {
final status = await Permission.camera.request();
if (status == PermissionStatus.granted) {
final image = await ImagePicker()
.pickImage(source: ImageSource.camera);
if (image != null && image.path != null) {
final croppedFile = await ImageCropper()
.cropImage(sourcePath: image.path);
final bytes = await croppedFile.readAsBytes();
multipartFile = MultipartFile.fromBytes('file', bytes,
filename: image.path.split('/').last);
}
} else {
openAppSettings();
}
}
if (multipartFile != null) {
viewModel.onUploadDocument(
navigatorKey.currentContext, multipartFile);
}
},
child: Icon(
Icons.camera_alt,
color: Colors.white,
),
tooltip: localization.create,
);
})
: null,
); );
} }
} }

View File

@ -128,16 +128,6 @@ class _ProjectViewState extends State<ProjectView>
], ],
); );
}), }),
floatingActionButton: FloatingActionButton(
heroTag: 'project_view_fab',
backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () => viewModel.onAddTaskPressed(context),
child: Icon(
Icons.add,
color: Colors.white,
),
tooltip: localization.newTask,
),
); );
} }
} }

View File

@ -137,21 +137,6 @@ class _TaskViewState extends State<TaskView>
], ],
); );
}), }),
floatingActionButton: Builder(builder: (BuildContext context) {
return task.isInvoiced || task.isDeleted
? SizedBox()
: FloatingActionButton(
heroTag: 'task_view_fab',
backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () => viewModel.onFabPressed(context),
child: Icon(
task.isRunning ? Icons.stop : Icons.play_arrow,
color: Colors.white,
),
tooltip:
task.isRunning ? localization.stop : localization.start,
);
}),
); );
} }
} }

View File

@ -172,16 +172,6 @@ class _VendorViewState extends State<VendorView>
], ],
); );
}), }),
floatingActionButton: FloatingActionButton(
heroTag: 'vendor_view_fab',
backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () => viewModel.onAddExpensePressed(context),
child: Icon(
Icons.add,
color: Colors.white,
),
tooltip: localization.create,
),
); );
} }
} }