forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.dart
More file actions
147 lines (138 loc) · 5.82 KB
/
Copy pathpage.dart
File metadata and controls
147 lines (138 loc) · 5.82 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
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:omi/backend/schema/conversation.dart';
import 'package:omi/pages/capture/widgets/widgets.dart';
import 'package:omi/providers/conversation_provider.dart';
import 'package:omi/utils/l10n_extensions.dart';
class ProcessingConversationPage extends StatefulWidget {
final ServerConversation conversation;
const ProcessingConversationPage({super.key, required this.conversation});
@override
State<ProcessingConversationPage> createState() => _ProcessingConversationPageState();
}
class _ProcessingConversationPageState extends State<ProcessingConversationPage> with TickerProviderStateMixin {
final scaffoldKey = GlobalKey<ScaffoldState>();
TabController? _controller;
@override
void initState() {
_controller = TabController(length: 2, vsync: this, initialIndex: 0);
_controller!.addListener(() => setState(() {}));
super.initState();
}
@override
Widget build(BuildContext context) {
return Consumer<ConversationProvider>(
builder: (context, provider, child) {
// Conversation source
var convoSource = widget.conversation.source;
bool hasPhotos = widget.conversation.photos.isNotEmpty;
String contentTabLabel;
if (convoSource == ConversationSource.openglass) {
contentTabLabel = context.l10n.photos;
} else if (convoSource == ConversationSource.screenpipe) {
contentTabLabel = context.l10n.rawData;
} else {
contentTabLabel = context.l10n.content;
}
return PopScope(
canPop: true,
child: Scaffold(
key: scaffoldKey,
backgroundColor: Theme.of(context).colorScheme.primary,
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Theme.of(context).colorScheme.primary,
title: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
key: const ValueKey('processing_conversation_back_button'),
onPressed: () {
Navigator.pop(context);
return;
},
icon: const Icon(Icons.arrow_back_rounded, size: 24.0),
),
const SizedBox(width: 4),
Text(hasPhotos ? "📸" : "🎙️"),
const SizedBox(width: 4),
Expanded(child: Text(context.l10n.inProgress)),
],
),
),
body: Column(
children: [
TabBar(
key: const ValueKey('processing_conversation_tab_bar'),
indicatorSize: TabBarIndicatorSize.label,
isScrollable: false,
padding: EdgeInsets.zero,
indicatorPadding: EdgeInsets.zero,
controller: _controller,
labelStyle: Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 18),
tabs: [
Tab(text: contentTabLabel),
Tab(text: context.l10n.summary),
],
indicator: BoxDecoration(color: Colors.transparent, borderRadius: BorderRadius.circular(16)),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: TabBarView(
controller: _controller,
physics: const NeverScrollableScrollPhysics(),
children: [
ListView(
shrinkWrap: true,
children: [
if (widget.conversation.transcriptSegments.isNotEmpty ||
widget.conversation.photos.isNotEmpty)
getTranscriptWidget(
false,
widget.conversation.transcriptSegments,
widget.conversation.photos,
null,
),
if (!hasPhotos && widget.conversation.transcriptSegments.isEmpty)
Column(
children: [
const SizedBox(height: 80),
Center(child: Text(context.l10n.noContentToDisplay)),
],
),
const SizedBox(height: 32),
],
),
ListView(
shrinkWrap: true,
children: [
const SizedBox(height: 80),
Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
widget.conversation.transcriptSegments.isEmpty
? context.l10n.noSummary
: context.l10n.statusProcessing,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16),
),
),
),
],
),
],
),
),
),
],
),
),
);
},
);
}
}