Skip to content

Commit 1a0d180

Browse files
chore: Implement tabbed inline view to enable testing inline bug (#283)
1 parent c380c09 commit 1a0d180

File tree

1 file changed

+136
-25
lines changed

1 file changed

+136
-25
lines changed

apps/amiapp_flutter/lib/src/screens/inline_messages.dart

Lines changed: 136 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,158 @@ import 'package:flutter/material.dart';
55

66
import '../components/container.dart';
77

8-
class InlineMessagesScreen extends StatelessWidget {
8+
class InlineMessagesScreen extends StatefulWidget {
99
const InlineMessagesScreen({super.key});
1010

11+
@override
12+
State<InlineMessagesScreen> createState() => _InlineMessagesScreenState();
13+
}
14+
15+
class _InlineMessagesScreenState extends State<InlineMessagesScreen>
16+
with SingleTickerProviderStateMixin {
17+
late TabController _tabController;
18+
19+
@override
20+
void initState() {
21+
super.initState();
22+
_tabController = TabController(length: 2, vsync: this);
23+
}
24+
25+
@override
26+
void dispose() {
27+
_tabController.dispose();
28+
super.dispose();
29+
}
30+
1131
@override
1232
Widget build(BuildContext context) {
1333
return AppContainer(
1434
appBar: AppBar(
1535
title: const Text('Inline Message Test'),
36+
bottom: TabBar(
37+
controller: _tabController,
38+
tabs: const [
39+
Tab(text: 'Single View'),
40+
Tab(text: 'Multiple Views'),
41+
],
42+
),
43+
),
44+
body: TabBarView(
45+
controller: _tabController,
46+
children: [
47+
_buildSingleViewTab(),
48+
_buildMultipleViewsTab(),
49+
],
1650
),
17-
body: Column(
51+
);
52+
}
53+
54+
Widget _buildSingleViewTab() {
55+
return SingleChildScrollView(
56+
padding: const EdgeInsets.all(16),
57+
child: Column(
1858
children: [
19-
// Sticky Header Inline Message
59+
Container(
60+
width: double.infinity,
61+
padding: const EdgeInsets.all(12),
62+
margin: const EdgeInsets.only(bottom: 16),
63+
decoration: BoxDecoration(
64+
color: Colors.blue[50],
65+
borderRadius: BorderRadius.circular(8),
66+
border: Border.all(color: Colors.blue[200]!),
67+
),
68+
child: Column(
69+
crossAxisAlignment: CrossAxisAlignment.start,
70+
children: [
71+
Text(
72+
'Element IDs in this tab:',
73+
style: TextStyle(
74+
fontWeight: FontWeight.bold,
75+
color: Colors.blue[800],
76+
fontSize: 14,
77+
),
78+
),
79+
const SizedBox(height: 4),
80+
Text(
81+
'• single-inline',
82+
style: TextStyle(
83+
color: Colors.blue[700],
84+
fontSize: 13,
85+
fontFamily: 'monospace',
86+
),
87+
),
88+
],
89+
),
90+
),
2091
InlineInAppMessageView(
21-
elementId: 'sticky-header',
92+
elementId: 'single-inline',
2293
onActionClick: _showInlineActionClick,
2394
),
24-
Expanded(
25-
child: SingleChildScrollView(
26-
padding: const EdgeInsets.all(16),
27-
child: Column(
28-
children: [
29-
_buildImageAndTextBlock(),
30-
_buildFullWidthCard(),
31-
_buildThreeColumnRow(),
32-
const SizedBox(height: 16),
33-
InlineInAppMessageView(
34-
elementId: 'inline',
35-
onActionClick: _showInlineActionClick,
95+
const SizedBox(height: 16),
96+
_buildImageAndTextBlock(),
97+
_buildFullWidthCard(),
98+
_buildThreeColumnRow(),
99+
],
100+
),
101+
);
102+
}
103+
104+
Widget _buildMultipleViewsTab() {
105+
return SingleChildScrollView(
106+
padding: const EdgeInsets.all(16),
107+
child: Column(
108+
children: [
109+
Container(
110+
width: double.infinity,
111+
padding: const EdgeInsets.all(12),
112+
margin: const EdgeInsets.only(bottom: 16),
113+
decoration: BoxDecoration(
114+
color: Colors.green[50],
115+
borderRadius: BorderRadius.circular(8),
116+
border: Border.all(color: Colors.green[200]!),
117+
),
118+
child: Column(
119+
crossAxisAlignment: CrossAxisAlignment.start,
120+
children: [
121+
Text(
122+
'Element IDs in this tab:',
123+
style: TextStyle(
124+
fontWeight: FontWeight.bold,
125+
color: Colors.green[800],
126+
fontSize: 14,
36127
),
37-
_buildImageAndTextBlock(),
38-
_buildFullWidthCard(),
39-
_buildThreeColumnRow(),
40-
const SizedBox(height: 16),
41-
InlineInAppMessageView(
42-
elementId: 'below-fold',
43-
onActionClick: _showInlineActionClick,
128+
),
129+
const SizedBox(height: 4),
130+
Text(
131+
'• multi-top\n• multi-middle\n• multi-bottom',
132+
style: TextStyle(
133+
color: Colors.green[700],
134+
fontSize: 13,
135+
fontFamily: 'monospace',
44136
),
45-
],
46-
),
137+
),
138+
],
47139
),
48140
),
141+
InlineInAppMessageView(
142+
elementId: 'multi-top',
143+
onActionClick: _showInlineActionClick,
144+
),
145+
const SizedBox(height: 16),
146+
_buildImageAndTextBlock(),
147+
_buildFullWidthCard(),
148+
const SizedBox(height: 16),
149+
InlineInAppMessageView(
150+
elementId: 'multi-middle',
151+
onActionClick: _showInlineActionClick,
152+
),
153+
const SizedBox(height: 16),
154+
_buildThreeColumnRow(),
155+
const SizedBox(height: 16),
156+
InlineInAppMessageView(
157+
elementId: 'multi-bottom',
158+
onActionClick: _showInlineActionClick,
159+
),
49160
],
50161
),
51162
);

0 commit comments

Comments
 (0)