Line data Source code
1 : import 'package:flutter/material.dart';
2 : import 'package:freezed_annotation/freezed_annotation.dart';
3 : import 'package:redfire/types.dart';
4 : import 'package:redfire/widgets.dart';
5 :
6 : import '../../sections/widgets/section-detail/section_detail_page.dart';
7 : import '../widgets/project-detail/sections_view.dart';
8 :
9 : part 'project_detail_page.freezed.dart';
10 : part 'project_detail_page.g.dart';
11 :
12 : @freezed
13 : class ProjectDetailPageData extends PageData
14 : with _$ProjectDetailPageData, ReduxState {
15 : static const String className = 'ProjectDetailPageData';
16 :
17 2 : const ProjectDetailPageData._();
18 : const factory ProjectDetailPageData() = _ProjectDetailPageData;
19 :
20 0 : factory ProjectDetailPageData.fromJson(JsonMap json) =>
21 0 : _$ProjectDetailPageDataFromJson(json);
22 :
23 0 : @override
24 : String get typeName => className;
25 : }
26 :
27 : class ProjectDetailPageTransforms extends PageDataTransforms {
28 0 : ProjectDetailPageTransforms()
29 0 : : super(
30 : typeName: ProjectDetailPageData.className,
31 0 : toMaterialPage: (pageData) => MaterialPage<dynamic>(
32 : key: const ValueKey(ProjectDetailPageData),
33 0 : child: ProjectDetailPage(pageData as ProjectDetailPageData)),
34 0 : fromJson: (json) => ProjectDetailPageData.fromJson(json),
35 : );
36 : }
37 :
38 : class ProjectDetailPage extends StatelessWidget {
39 0 : const ProjectDetailPage(ProjectDetailPageData data, {Key? key})
40 0 : : super(key: key);
41 :
42 0 : @override
43 : Widget build(BuildContext context) {
44 0 : return LayoutBuilder(builder: (context, constraints) {
45 0 : if (constraints.maxWidth < 500) return const SectionsView();
46 0 : return Scaffold(
47 0 : appBar: EmptyAppBar(),
48 0 : body: Row(
49 : children: const [
50 : SizedBox(width: 300, child: SectionsView()),
51 : SectionDetailPage()
52 : ],
53 : ),
54 : );
55 : });
56 : }
57 : }
|