-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.dart
More file actions
2065 lines (1921 loc) · 65.5 KB
/
main.dart
File metadata and controls
2065 lines (1921 loc) · 65.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:media_break_points/media_break_points.dart';
import 'package:media_break_points/patterns.dart';
part 'src/demo_support.dart';
part 'src/demo_showcases.dart';
void main() {
initMediaBreakPoints(const MediaBreakPointsConfig(considerOrientation: true));
runApp(const AdaptiveDemoApp());
}
class AdaptiveDemoApp extends StatelessWidget {
const AdaptiveDemoApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Media Break Points Demo',
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF0B6E4F)),
),
home: const DemoCatalogPage(),
);
}
}
const _defaultDashboardMetrics = [
_DashboardMetricData(
id: 'flows',
title: 'Active flows',
value: '18',
detail: '+4 this week',
color: Color(0xFFD9F0E4),
),
_DashboardMetricData(
id: 'completion',
title: 'Completion rate',
value: '93%',
detail: 'Strong on tablet and desktop',
color: Color(0xFFFCE7C8),
),
_DashboardMetricData(
id: 'layouts',
title: 'Saved layouts',
value: '42',
detail: 'All variants share the same data model',
color: Color(0xFFDCEBFF),
),
_DashboardMetricData(
id: 'experiments',
title: 'Experiments',
value: '7',
detail: '2 container-driven views in progress',
color: Color(0xFFF7DDF3),
),
];
const _defaultWorkspaceRecords = [
_WorkspaceRecord(
name: 'Ava Johnson',
role: 'Design systems',
status: 'Reviewing',
throughput: 12,
),
_WorkspaceRecord(
name: 'Noah Clarke',
role: 'Platform',
status: 'Building',
throughput: 9,
),
_WorkspaceRecord(
name: 'Mia Lopez',
role: 'Growth',
status: 'Queued',
throughput: 7,
),
];
const _metricLabQueries = [
_MetricLabQuery(
title: 'Latency by region',
summary: 'P95 latency across edge regions',
status: 'Monitoring',
value: '182ms',
trend: '-12ms',
accent: Color(0xFFDCEBFF),
notes: [
'us-east stabilized after the rollback window closed',
'eu-west remains comfortably within baseline',
'The chart is sensitive to short-lived cache misses',
],
),
_MetricLabQuery(
title: 'Checkout conversion',
summary: 'Conversion through the new payment path',
status: 'Investigating',
value: '3.8%',
trend: '-0.4%',
accent: Color(0xFFFCE7C8),
notes: [
'Drop aligns with the experimental payment-step copy',
'Mobile sessions recovered faster than desktop sessions',
'Responder notes are attached to the rollout annotation band',
],
),
_MetricLabQuery(
title: 'Queue depth',
summary: 'Pending jobs across ingestion workers',
status: 'Healthy',
value: '241',
trend: '-18%',
accent: Color(0xFFD9F0E4),
notes: [
'Backfill pressure is receding after worker rebalance',
'One cluster is still catching up after maintenance',
'History helps compare today against the last mitigation pass',
],
),
];
const _experimentLabItems = [
_ExperimentLabItem(
title: 'Checkout copy test',
summary: 'Variant B shortens the payment step headline',
status: 'Review',
primaryMetric: '+0.4% conversion',
secondaryMetric: '-3.1% hesitation',
accent: Color(0xFFFCE7C8),
evidence: [
'Mobile conversion improved faster than desktop conversion',
'The largest lift came from returning customers',
'Support tickets did not increase during the experiment window',
],
),
_ExperimentLabItem(
title: 'Onboarding checklist',
summary: 'Variant C reorders setup milestones by activation risk',
status: 'Monitoring',
primaryMetric: '+9% completion',
secondaryMetric: '-14% setup time',
accent: Color(0xFFDCEBFF),
evidence: [
'Completion lift held across small and medium teams',
'Users spent less time searching for the next action',
'There was no drop in downstream feature adoption',
],
),
_ExperimentLabItem(
title: 'Search zero-state',
summary: 'Variant A promotes recent work before templates',
status: 'Healthy',
primaryMetric: '+11% first click',
secondaryMetric: '+6% retained sessions',
accent: Color(0xFFD9F0E4),
evidence: [
'Teams with larger project sets benefited the most',
'Template engagement remained within expected variance',
'Follow-up search depth fell after the first action',
],
),
];
const _planningDeskItems = [
_PlanningDeskItem(
title: 'Q3 platform launch',
summary:
'Coordinate rollout, enablement, and verification across product teams',
status: 'Active',
horizon: '6 weeks',
owner: 'Platform PM',
accent: Color(0xFFDCEBFF),
checkpoints: [
'Enablement docs must be approved before the canary begins',
'Support runbooks should be complete by the beta milestone',
'Verification coverage needs a final pass before general availability',
],
),
_PlanningDeskItem(
title: 'Analytics refresh',
summary: 'Reshape dashboards and query flows around adaptive workspaces',
status: 'Review',
horizon: '4 weeks',
owner: 'Design systems',
accent: Color(0xFFFCE7C8),
checkpoints: [
'Query patterns need validation across compact and expanded surfaces',
'Nested card behavior must be documented in the examples catalog',
'The analyzer and widget suite should remain stable through refactors',
],
),
_PlanningDeskItem(
title: 'Workspace migration',
summary: 'Move legacy layout screens to shared adaptive primitives',
status: 'Queued',
horizon: '8 weeks',
owner: 'Core UI',
accent: Color(0xFFD9F0E4),
checkpoints: [
'Shared navigation rules need signoff from the apps team',
'Compact overflow regressions should be closed before migration begins',
'Release checklists need to reference the new catalog pages',
],
),
];
const _releaseLabItems = [
_ReleaseLabItem(
title: 'Adaptive catalog 2.0',
summary:
'Coordinate final launch checks for the expanded workspace catalog',
status: 'Readiness',
readiness: '92%',
owner: 'Release manager',
accent: Color(0xFFDCEBFF),
gates: [
'Desktop overflow regressions must stay closed after demo updates',
'Release notes need screenshots for the new workflow primitives',
'Widget and analyzer passes must remain green before tagging',
],
),
_ReleaseLabItem(
title: 'Analytics workspace bundle',
summary: 'Ship metrics and experiment surfaces as one documented release',
status: 'Review',
readiness: '81%',
owner: 'Analytics lead',
accent: Color(0xFFFCE7C8),
gates: [
'Examples need copy review for the new analytics catalog entries',
'Nested container behavior should be documented in the README',
'Upgrade guidance needs a short migration note for adopters',
],
),
_ReleaseLabItem(
title: 'Planning workspace rollout',
summary:
'Promote planning and release surfaces to the public package story',
status: 'Queued',
readiness: '68%',
owner: 'Core UI',
accent: Color(0xFFD9F0E4),
gates: [
'Launch checklist needs signoff from design systems and docs',
'Risk copy should be tuned for consistency across planning demos',
'A changelog summary should be ready before the version bump',
],
),
];
const _approvalDeskItems = [
_ApprovalDeskItem(
title: 'Workspace shell signoff',
summary:
'Approve the staged workspace shell before the next public package cut',
status: 'Needs review',
stage: 'Design + docs',
approver: 'UI council',
accent: Color(0xFFDCEBFF),
criteria: [
'Catalog pages must cover both full-width and nested container cases',
'README guidance should explain when each staged workspace is appropriate',
'The shell must remain free of transient overflow during mode changes',
],
history: [
'Design systems approved the navigation model yesterday',
'Docs requested a shorter migration note for external adopters',
'Final signoff is blocked on the release-readiness screenshots',
],
),
_ApprovalDeskItem(
title: 'Analytics workspace docs',
summary: 'Approve the documentation pass for analytics and explorer labs',
status: 'In review',
stage: 'Docs review',
approver: 'Developer education',
accent: Color(0xFFFCE7C8),
criteria: [
'Analytics examples should stay distinct from planning and release flows',
'Each adaptive lab needs a concise rationale in the README',
'The example catalog copy should stay short enough to scan on mobile',
],
history: [
'The first copy pass was merged after terminology cleanup',
'A second review requested stronger container-query explanations',
'Legal confirmed the demo content is generic and safe to publish',
],
),
_ApprovalDeskItem(
title: 'Release checklist refresh',
summary:
'Approve the updated release checklist before tagging the next version',
status: 'Queued',
stage: 'Operations',
approver: 'Release managers',
accent: Color(0xFFD9F0E4),
criteria: [
'Approval flows must reference analyzer and widget verification steps',
'The changelog note should mention new staged workspace primitives',
'Versioning guidance should match the package maintenance workflow',
],
history: [
'The checklist owner added a final pre-tag verification section',
'Release engineering requested a clearer rollback note',
'Approval is waiting on the next dry-run release rehearsal',
],
),
];
class DemoCatalogPage extends StatelessWidget {
const DemoCatalogPage({super.key});
static final _entries = <_DemoEntry>[
_DemoEntry(
category: _DemoCategory.coreShellsAndSurfaces,
title: 'Adaptive Scaffold',
description: 'Run the full shell demo with bottom nav, rail, and drawer.',
icon: Icons.dashboard_customize_outlined,
builder: (_) => const AdaptiveScaffoldDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreShellsAndSurfaces,
title: 'Workspace Shell',
description:
'Compose navigation, actions, and an inspector from one shell widget.',
icon: Icons.web_asset_outlined,
builder: (_) => const AdaptiveWorkspaceShellDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Adaptive Sections',
description:
'Use compact chips or a docked section sidebar for settings screens.',
icon: Icons.segment_outlined,
builder: (_) => const AdaptiveSectionsDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreShellsAndSurfaces,
title: 'Adaptive Data View',
description: 'Switch between compact record cards and a table layout.',
icon: Icons.table_rows_outlined,
builder: (_) => const AdaptiveDataViewDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Board',
description:
'Stack workflow lanes on compact space and spread them into a board on larger surfaces.',
icon: Icons.view_kanban_outlined,
builder: (_) => const AdaptiveBoardDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Timeline',
description:
'Move roadmap milestones between stacked cards and a horizontal timeline.',
icon: Icons.timeline_outlined,
builder: (_) => const AdaptiveTimelineDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Comparison',
description:
'Show one selected option on compact space and all options side by side on larger layouts.',
icon: Icons.compare_arrows_outlined,
builder: (_) => const AdaptiveComparisonDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreShellsAndSurfaces,
title: 'Adaptive Diff View',
description:
'Review two fixed versions in compact toggle mode or side-by-side diff mode.',
icon: Icons.compare_outlined,
builder: (_) => const AdaptiveDiffViewDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Schedule',
description:
'Show a stacked agenda on compact space and day columns on larger layouts.',
icon: Icons.calendar_view_day_outlined,
builder: (_) => const AdaptiveScheduleDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Calendar',
description:
'Switch between a stacked agenda and a multi-column day grid.',
icon: Icons.calendar_month_outlined,
builder: (_) => const AdaptiveCalendarDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Deck',
description:
'Page through focused cards on compact space and fan them into a grid on larger layouts.',
icon: Icons.view_carousel_outlined,
builder: (_) => const AdaptiveDeckDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Gallery',
description:
'Move between a compact preview carousel and a larger spotlight layout.',
icon: Icons.photo_library_outlined,
builder: (_) => const AdaptiveGalleryDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreShellsAndSurfaces,
title: 'Adaptive Filter Layout',
description:
'Keep results primary on compact layouts and dock filters inline on larger surfaces.',
icon: Icons.filter_alt_outlined,
builder: (_) => const AdaptiveFilterLayoutDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreShellsAndSurfaces,
title: 'Adaptive Result Browser',
description:
'Open result details modally on compact layouts and dock them inline on larger surfaces.',
icon: Icons.travel_explore_outlined,
builder: (_) => const AdaptiveResultBrowserDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Explorer',
description:
'Combine filters, results, and detail panels into one adaptive browsing workspace.',
icon: Icons.explore_outlined,
builder: (_) => const AdaptiveExplorerDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreShellsAndSurfaces,
title: 'Adaptive Document View',
description:
'Keep long-form content primary on compact layouts and dock its outline on larger surfaces.',
icon: Icons.article_outlined,
builder: (_) => const AdaptiveDocumentViewDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Workbench',
description:
'Stage a library, canvas, and inspector with progressive panel docking.',
icon: Icons.design_services_outlined,
builder: (_) => const AdaptiveWorkbenchDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Review Desk',
description:
'Stage a queue, review surface, and decision panel with progressive docking.',
icon: Icons.rate_review_outlined,
builder: (_) => const AdaptiveReviewDeskDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Conversation Desk',
description:
'Stage conversations, an active thread, and a context panel with progressive docking.',
icon: Icons.forum_outlined,
builder: (_) => const AdaptiveConversationDeskDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Composer',
description:
'Stage editor, preview, and settings surfaces with progressive docking.',
icon: Icons.edit_note_outlined,
builder: (_) => const AdaptiveComposerDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Presentation Desk',
description:
'Stage slides, a presentation stage, and speaker notes with progressive docking.',
icon: Icons.slideshow_outlined,
builder: (_) => const AdaptivePresentationDeskDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Control Center',
description:
'Stage a sidebar, dashboard, insights, and activity stream with progressive docking.',
icon: Icons.monitor_heart_outlined,
builder: (_) => const AdaptiveControlCenterDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Incident Desk',
description:
'Stage incidents, active detail, responder context, and timeline panels with progressive docking.',
icon: Icons.crisis_alert_outlined,
builder: (_) => const AdaptiveIncidentDeskDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Metrics Lab',
description:
'Stage saved queries, active chart focus, annotations, and query history with progressive docking.',
icon: Icons.query_stats_outlined,
builder: (_) => const AdaptiveMetricsLabDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Experiment Lab',
description:
'Stage experiments, active variant focus, evidence, and decision history with progressive docking.',
icon: Icons.science_outlined,
builder: (_) => const AdaptiveExperimentLabDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Planning Desk',
description:
'Stage plans, active focus, risks, and milestones with progressive docking.',
icon: Icons.event_note_outlined,
builder: (_) => const AdaptivePlanningDeskDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Release Lab',
description:
'Stage releases, readiness, blockers, and rollout logs with progressive docking.',
icon: Icons.rocket_launch_outlined,
builder: (_) => const AdaptiveReleaseLabDemoPage(),
),
_DemoEntry(
category: _DemoCategory.showcasePatterns,
title: 'Adaptive Approval Desk',
description:
'Stage approvals, active proposals, criteria, and decision history with progressive docking.',
icon: Icons.approval_outlined,
builder: (_) => const AdaptiveApprovalDeskDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreEngine,
title: 'Responsive Values',
description: 'Semantic breakpoints, fluid spacing, and typography.',
icon: Icons.space_dashboard_outlined,
builder: (_) => const ResponsiveValuesDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreEngine,
title: 'Height-aware Layouts',
description:
'Resolve adaptive rules from vertical space as well as width.',
icon: Icons.height_outlined,
builder: (_) => const HeightAwareLayoutsDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreEngine,
title: 'Container Layouts',
description: 'Parent-width aware layouts using container queries.',
icon: Icons.crop_16_9_outlined,
builder: (_) => const ContainerLayoutsDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Adaptive Container',
description: 'Semantic slots and container-aware widget switching.',
icon: Icons.view_agenda_outlined,
builder: (_) => const AdaptiveContainerDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreEngine,
title: 'Animated Layouts',
description:
'Breakpoint transitions driven by AnimatedResponsiveLayoutBuilder.',
icon: Icons.animation_outlined,
builder: (_) => const AnimatedLayoutsDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Adaptive Cluster',
description: 'One child list that can stack, wrap, or line up inline.',
icon: Icons.widgets_outlined,
builder: (_) => const AdaptiveClusterDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Adaptive Action Bar',
description: 'Priority-aware toolbars that overflow gracefully.',
icon: Icons.more_horiz,
builder: (_) => const AdaptiveActionBarDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Auto Grid',
description: 'Column counts derived from the available width.',
icon: Icons.grid_view_outlined,
builder: (_) => const AutoGridDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Reorderable Grid',
description: 'Adaptive dashboard cards with drag-and-drop reordering.',
icon: Icons.view_quilt_outlined,
builder: (_) => const ReorderableGridDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Adaptive Pane',
description: 'Master-detail layouts that stack or split by size.',
icon: Icons.splitscreen_outlined,
builder: (_) => const AdaptivePaneDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Priority Layout',
description: 'Primary-first layouts with collapsible supporting context.',
icon: Icons.low_priority_outlined,
builder: (_) => const AdaptivePriorityDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Adaptive Inspector',
description: 'Dock a sidebar inline or open it as a modal inspector.',
icon: Icons.tune_outlined,
builder: (_) => const AdaptiveInspectorDemoPage(),
),
_DemoEntry(
category: _DemoCategory.corePrimitives,
title: 'Adaptive Form',
description:
'Section cards on wide screens and a stepper on compact ones.',
icon: Icons.rule_folder_outlined,
builder: (_) => const AdaptiveFormDemoPage(),
),
_DemoEntry(
category: _DemoCategory.coreEngine,
title: 'Debug Overlay',
description: 'Inspect active breakpoint and container state live.',
icon: Icons.bug_report_outlined,
builder: (_) => const DebugOverlayDemoPage(),
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Media Break Points Demo')),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Package feature catalog',
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(height: 8),
Text(
'Core features are grouped first. Showcase patterns stay in the catalog, '
'but they are examples of composition rather than the package’s main API story. '
'Import showcase entries from package:media_break_points/patterns.dart.',
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 20),
for (final category in _DemoCategory.values) ...[
_DemoCategorySection(
category: category,
entries: [
for (final entry in _entries)
if (entry.category == category) entry,
],
),
const SizedBox(height: 24),
],
],
),
),
),
);
}
}
enum _DemoCategory {
coreEngine,
corePrimitives,
coreShellsAndSurfaces,
showcasePatterns,
}
extension on _DemoCategory {
String get title {
return switch (this) {
_DemoCategory.coreEngine => 'Core Engine',
_DemoCategory.corePrimitives => 'Core Primitives',
_DemoCategory.coreShellsAndSurfaces => 'Core Shells And Surfaces',
_DemoCategory.showcasePatterns => 'Showcase Patterns',
};
}
String get description {
return switch (this) {
_DemoCategory.coreEngine =>
'Breakpoint data, responsive values, container queries, animation helpers, and debugging tools.',
_DemoCategory.corePrimitives =>
'Reusable spatial building blocks that introduce real layout behavior.',
_DemoCategory.coreShellsAndSurfaces =>
'The small set of high-value shells and content surfaces that form the main package story.',
_DemoCategory.showcasePatterns =>
'Possible product-shaped compositions built from the core primitives. Import them from package:media_break_points/patterns.dart.',
};
}
bool get isCore => this != _DemoCategory.showcasePatterns;
String get badgeLabel => isCore ? 'Core' : 'Showcase';
}
class _DemoEntry {
final _DemoCategory category;
final String title;
final String description;
final IconData icon;
final WidgetBuilder builder;
const _DemoEntry({
required this.category,
required this.title,
required this.description,
required this.icon,
required this.builder,
});
}
class _DemoCategorySection extends StatelessWidget {
final _DemoCategory category;
final List<_DemoEntry> entries;
const _DemoCategorySection({required this.category, required this.entries});
@override
Widget build(BuildContext context) {
if (entries.isEmpty) {
return const SizedBox.shrink();
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(category.title, style: Theme.of(context).textTheme.headlineSmall),
const SizedBox(height: 8),
Text(
category.description,
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 16),
AutoResponsiveGrid(
minItemWidth: 260,
columnSpacing: 16,
rowSpacing: 16,
children: [for (final entry in entries) _DemoEntryCard(entry: entry)],
),
],
);
}
}
class _DemoEntryCard extends StatelessWidget {
final _DemoEntry entry;
const _DemoEntryCard({required this.entry});
@override
Widget build(BuildContext context) {
return Card(
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: () {
Navigator.of(
context,
).push(MaterialPageRoute<void>(builder: entry.builder));
},
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DecoratedBox(
decoration: BoxDecoration(
color: entry.category.isCore
? Theme.of(context).colorScheme.secondaryContainer
: Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(999),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 6,
),
child: Text(
entry.category.badgeLabel,
style: Theme.of(context).textTheme.labelMedium?.copyWith(
fontWeight: FontWeight.w700,
),
),
),
),
const SizedBox(height: 16),
Icon(entry.icon, size: 28),
const SizedBox(height: 16),
Text(entry.title, style: Theme.of(context).textTheme.titleLarge),
const SizedBox(height: 8),
Text(entry.description),
],
),
),
),
);
}
}
class _FeatureDemoPage extends StatelessWidget {
final String title;
final String description;
final Widget child;
const _FeatureDemoPage({
required this.title,
required this.description,
required this.child,
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title, style: Theme.of(context).textTheme.headlineMedium),
const SizedBox(height: 8),
Text(description, style: Theme.of(context).textTheme.bodyLarge),
const SizedBox(height: 20),
child,
],
),
),
),
);
}
}
class AdaptiveScaffoldDemoPage extends StatefulWidget {
const AdaptiveScaffoldDemoPage({super.key});
@override
State<AdaptiveScaffoldDemoPage> createState() =>
_AdaptiveScaffoldDemoPageState();
}
class _AdaptiveScaffoldDemoPageState extends State<AdaptiveScaffoldDemoPage> {
static const _destinations = [
AdaptiveScaffoldDestination(
icon: Icon(Icons.dashboard_outlined),
selectedIcon: Icon(Icons.dashboard),
label: 'Dashboard',
),
AdaptiveScaffoldDestination(
icon: Icon(Icons.auto_awesome_mosaic_outlined),
selectedIcon: Icon(Icons.auto_awesome_mosaic),
label: 'Workspace',
),
AdaptiveScaffoldDestination(
icon: Icon(Icons.tune_outlined),
selectedIcon: Icon(Icons.tune),
label: 'Settings',
),
];
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return AdaptiveScaffold(
animateTransitions: true,
minimumRailHeight: AdaptiveHeight.medium,
minimumDrawerHeight: AdaptiveHeight.medium,
appBar: AppBar(title: Text(_pageTitle(_selectedIndex))),
selectedIndex: _selectedIndex,
onSelectedIndexChanged: (index) {
setState(() {
_selectedIndex = index;
});
},
destinations: _destinations,
navigationHeader: const _NavigationHeader(),
navigationFooter: const _NavigationFooter(),
body: ResponsiveDebugOverlay(
label: 'screen',
child: IndexedStack(
index: _selectedIndex,
children: const [DashboardPage(), WorkspacePage(), SettingsPage()],
),
),
);
}
String _pageTitle(int index) {
return switch (index) {
0 => 'Adaptive Dashboard',
1 => 'Workspace Layouts',
_ => 'Settings Form',
};
}
}
class AdaptiveWorkspaceShellDemoPage extends StatefulWidget {
const AdaptiveWorkspaceShellDemoPage({super.key});
@override
State<AdaptiveWorkspaceShellDemoPage> createState() =>
_AdaptiveWorkspaceShellDemoPageState();
}
class _AdaptiveWorkspaceShellDemoPageState
extends State<AdaptiveWorkspaceShellDemoPage> {
static const _destinations = [
AdaptiveScaffoldDestination(
icon: Icon(Icons.space_dashboard_outlined),
selectedIcon: Icon(Icons.space_dashboard),
label: 'Overview',
),
AdaptiveScaffoldDestination(
icon: Icon(Icons.fact_check_outlined),
selectedIcon: Icon(Icons.fact_check),
label: 'Review',
),
AdaptiveScaffoldDestination(
icon: Icon(Icons.settings_outlined),
selectedIcon: Icon(Icons.settings),
label: 'Settings',
),
];
static const _actions = [
AdaptiveActionBarAction(
icon: Icon(Icons.add),
label: 'Create flow',
priority: 4,
variant: AdaptiveActionVariant.filled,
pinToPrimaryRow: true,
),
AdaptiveActionBarAction(
icon: Icon(Icons.ios_share_outlined),
label: 'Share',
priority: 3,
variant: AdaptiveActionVariant.tonal,
),
AdaptiveActionBarAction(
icon: Icon(Icons.person_add_alt_1_outlined),
label: 'Invite',
priority: 2,
variant: AdaptiveActionVariant.outlined,
),
AdaptiveActionBarAction(
icon: Icon(Icons.file_download_outlined),
label: 'Export',
priority: 1,
variant: AdaptiveActionVariant.text,
),
];
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return AdaptiveWorkspaceShell(
title: _titleForIndex(_selectedIndex),
description: _descriptionForIndex(_selectedIndex),
appBarTitle: 'Adaptive Workspace Shell',
destinations: _destinations,
selectedIndex: _selectedIndex,
onSelectedIndexChanged: (index) {
setState(() {
_selectedIndex = index;
});
},
navigationHeader: const _NavigationHeader(),
navigationFooter: const _NavigationFooter(),
actions: _actions,
minimumRailHeight: AdaptiveHeight.medium,
minimumDrawerHeight: AdaptiveHeight.medium,
minimumInspectorDockedHeight: AdaptiveHeight.medium,
inspectorTitle: 'Workspace inspector',
inspectorDescription:
'Track adaptive state, workflow pressure, and pinned modules.',
inspectorLeading: const Icon(Icons.tune_outlined),
content: ResponsiveDebugOverlay(
label: 'workspace-shell',