Line data Source code
1 : import 'package:flutter/material.dart';
2 :
3 : import 'package:flutter_redux/flutter_redux.dart';
4 :
5 : import '../../../app_state.dart';
6 : import '../../../utils/build_context_extensions.dart';
7 : import '../../actions/update_projects_view_action.dart';
8 : import 'create_project_form.dart';
9 :
10 : class ProjectsGridItemNewButton extends StatelessWidget {
11 1 : const ProjectsGridItemNewButton({Key? key}) : super(key: key);
12 :
13 1 : @override
14 : Widget build(BuildContext context) {
15 1 : return StoreConnector<AppState, bool>(
16 : distinct: true,
17 4 : converter: (store) => store.state.projects.creating,
18 1 : builder: (context, creating) {
19 1 : return Padding(
20 : padding: const EdgeInsets.all(25.0),
21 1 : child: Card(
22 : elevation: 1.5,
23 1 : shape: RoundedRectangleBorder(
24 2 : side: BorderSide(color: Colors.blue[100]!, width: 2),
25 1 : borderRadius: BorderRadius.circular(10),
26 : ),
27 : child: (creating)
28 : ? const CreateProjectForm()
29 1 : : InkWell(
30 1 : splashColor: Colors.blue.withAlpha(30),
31 0 : onTap: () => context.dispatch(
32 : const UpdateProjectsViewAction(creating: true)),
33 1 : child: Center(
34 1 : child: Text('+',
35 3 : style: Theme.of(context).textTheme.headline5)),
36 : ),
37 : ),
38 : );
39 : });
40 : }
41 : }
|