Skip to content

Commit e1619fd

Browse files
authored
Move stop memory button to bottom center (#959)
https://github.com/user-attachments/assets/f8aecd77-2c40-4004-8f7d-6030c8753a0b <!-- This is an auto-generated comment: release notes by OSS Entelligence.AI --> ### Summary by Entelligence.AI - Style: Updated the `ConfirmationDialog` widget in the application. The font size for the description and action buttons has been increased to 14 for better readability and user experience. <!-- end of auto-generated comment: release notes by OSS Entelligence.AI -->
2 parents 1307d15 + ff17c29 commit e1619fd

File tree

2 files changed

+186
-172
lines changed

2 files changed

+186
-172
lines changed

app/lib/pages/memory_capturing/page.dart

Lines changed: 183 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -46,191 +46,204 @@ class _MemoryCapturingPageState extends State<MemoryCapturingPage> with TickerPr
4646

4747
@override
4848
Widget build(BuildContext context) {
49-
return Consumer2<CaptureProvider, DeviceProvider>(builder: (context, provider, deviceProvider, child) {
50-
// Track memory
51-
if ((provider.memoryProvider?.memories ?? []).isNotEmpty &&
52-
(provider.memoryProvider!.memories.first.id != widget.topMemoryId || widget.topMemoryId == null)) {
53-
_pushNewMemory(context, provider.memoryProvider!.memories.first);
54-
}
49+
return Consumer2<CaptureProvider, DeviceProvider>(
50+
builder: (context, provider, deviceProvider, child) {
51+
// Track memory
52+
if ((provider.memoryProvider?.memories ?? []).isNotEmpty &&
53+
(provider.memoryProvider!.memories.first.id != widget.topMemoryId || widget.topMemoryId == null)) {
54+
_pushNewMemory(context, provider.memoryProvider!.memories.first);
55+
}
5556

56-
// Memory source
57-
var memorySource = MemorySource.friend;
58-
// var captureProvider = context.read<CaptureProvider>();
59-
// if (captureProvider.isGlasses) {
60-
// memorySource = MemorySource.openglass;
61-
// }
62-
return PopScope(
63-
canPop: true,
64-
child: Scaffold(
65-
key: scaffoldKey,
66-
backgroundColor: Theme.of(context).colorScheme.primary,
67-
appBar: AppBar(
68-
automaticallyImplyLeading: false,
57+
// Memory source
58+
var memorySource = MemorySource.friend;
59+
// var captureProvider = context.read<CaptureProvider>();
60+
// if (captureProvider.isGlasses) {
61+
// memorySource = MemorySource.openglass;
62+
// }
63+
return PopScope(
64+
canPop: true,
65+
child: Scaffold(
66+
key: scaffoldKey,
6967
backgroundColor: Theme.of(context).colorScheme.primary,
70-
title: Row(
71-
mainAxisSize: MainAxisSize.max,
72-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
73-
crossAxisAlignment: CrossAxisAlignment.center,
74-
children: [
75-
IconButton(
76-
onPressed: () {
77-
Navigator.pop(context);
78-
return;
79-
},
80-
icon: const Icon(Icons.arrow_back_rounded, size: 24.0),
81-
),
82-
const SizedBox(width: 4),
83-
const Text("🎙️"),
84-
const SizedBox(width: 4),
85-
const Expanded(child: Text("In progress")),
86-
],
87-
),
88-
),
89-
body: Column(
90-
children: [
91-
TabBar(
92-
indicatorSize: TabBarIndicatorSize.label,
93-
isScrollable: false,
94-
padding: EdgeInsets.zero,
95-
indicatorPadding: EdgeInsets.zero,
96-
controller: _controller,
97-
labelStyle: Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 18),
98-
tabs: [
99-
Tab(
100-
text: memorySource == MemorySource.openglass
101-
? 'Photos'
102-
: memorySource == MemorySource.screenpipe
103-
? 'Raw Data'
104-
: 'Transcript',
68+
appBar: AppBar(
69+
automaticallyImplyLeading: false,
70+
backgroundColor: Theme.of(context).colorScheme.primary,
71+
title: Row(
72+
mainAxisSize: MainAxisSize.max,
73+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
74+
crossAxisAlignment: CrossAxisAlignment.center,
75+
children: [
76+
IconButton(
77+
onPressed: () {
78+
Navigator.pop(context);
79+
return;
80+
},
81+
icon: const Icon(Icons.arrow_back_rounded, size: 24.0),
10582
),
106-
const Tab(text: 'Summary')
83+
const SizedBox(width: 4),
84+
const Text("🎙️"),
85+
const SizedBox(width: 4),
86+
const Expanded(child: Text("In progress")),
10787
],
108-
indicator: BoxDecoration(color: Colors.transparent, borderRadius: BorderRadius.circular(16)),
10988
),
110-
Expanded(
111-
child: Padding(
112-
padding: const EdgeInsets.symmetric(horizontal: 16),
113-
child: TabBarView(
114-
controller: _controller,
115-
physics: const NeverScrollableScrollPhysics(),
116-
children: [
117-
ListView(
118-
shrinkWrap: true,
119-
children: [
120-
provider.segments.isEmpty
121-
? Column(
122-
children: [
123-
const SizedBox(height: 80),
124-
Center(
125-
child: Text(memorySource == MemorySource.friend ? "No transcript" : "Empty")),
126-
],
127-
)
128-
: getTranscriptWidget(
129-
provider.memoryCreating,
130-
provider.segments,
131-
[],
132-
deviceProvider.connectedDevice,
133-
)
134-
],
135-
),
136-
Padding(
137-
padding: const EdgeInsets.only(top: 140),
138-
child: ListView(
89+
),
90+
body: Column(
91+
children: [
92+
TabBar(
93+
indicatorSize: TabBarIndicatorSize.label,
94+
isScrollable: false,
95+
padding: EdgeInsets.zero,
96+
indicatorPadding: EdgeInsets.zero,
97+
controller: _controller,
98+
labelStyle: Theme.of(context).textTheme.titleLarge!.copyWith(fontSize: 18),
99+
tabs: [
100+
Tab(
101+
text: memorySource == MemorySource.openglass
102+
? 'Photos'
103+
: memorySource == MemorySource.screenpipe
104+
? 'Raw Data'
105+
: 'Transcript',
106+
),
107+
const Tab(text: 'Summary')
108+
],
109+
indicator: BoxDecoration(color: Colors.transparent, borderRadius: BorderRadius.circular(16)),
110+
),
111+
Expanded(
112+
child: Padding(
113+
padding: const EdgeInsets.symmetric(horizontal: 16),
114+
child: TabBarView(
115+
controller: _controller,
116+
physics: const NeverScrollableScrollPhysics(),
117+
children: [
118+
ListView(
139119
shrinkWrap: true,
140120
children: [
141-
const SizedBox(height: 80),
142-
Center(
143-
child: Padding(
144-
padding: const EdgeInsets.symmetric(horizontal: 32.0),
145-
child: Text(
146-
provider.segments.isEmpty
147-
? "No summary"
148-
: "We summarize conversations 2 minutes after they end\n\nWant to end it now?",
149-
textAlign: TextAlign.center,
150-
style: const TextStyle(fontSize: 16),
121+
provider.segments.isEmpty
122+
? Column(
123+
children: [
124+
const SizedBox(height: 80),
125+
Center(
126+
child: Text(memorySource == MemorySource.friend ? "No transcript" : "Empty")),
127+
],
128+
)
129+
: getTranscriptWidget(
130+
provider.memoryCreating,
131+
provider.segments,
132+
[],
133+
deviceProvider.connectedDevice,
134+
)
135+
],
136+
),
137+
Padding(
138+
padding: const EdgeInsets.only(top: 140),
139+
child: ListView(
140+
shrinkWrap: true,
141+
children: [
142+
const SizedBox(height: 80),
143+
Center(
144+
child: Padding(
145+
padding: const EdgeInsets.symmetric(horizontal: 32.0),
146+
child: Text(
147+
provider.segments.isEmpty
148+
? "No summary"
149+
: "Conversation is summarized after 2 minutes of no speech 🤫",
150+
textAlign: TextAlign.center,
151+
style: const TextStyle(fontSize: 16),
152+
),
151153
),
152154
),
153-
),
154-
const SizedBox(
155-
height: 16,
156-
),
157-
provider.segments.isEmpty
158-
? const SizedBox()
159-
: Container(
160-
decoration: BoxDecoration(
161-
border: const GradientBoxBorder(
162-
gradient: LinearGradient(colors: [
163-
Color.fromARGB(127, 208, 208, 208),
164-
Color.fromARGB(127, 188, 99, 121),
165-
Color.fromARGB(127, 86, 101, 182),
166-
Color.fromARGB(127, 126, 190, 236)
167-
]),
168-
width: 2,
169-
),
170-
borderRadius: BorderRadius.circular(12),
171-
),
172-
margin: const EdgeInsets.symmetric(horizontal: 48),
173-
child: MaterialButton(
174-
onPressed: () async {
175-
print(showSummarizeConfirmation);
176-
if (!showSummarizeConfirmation) {
177-
context.read<CaptureProvider>().createMemory();
178-
return;
179-
}
180-
showDialog(
181-
context: context,
182-
builder: (context) {
183-
return StatefulBuilder(builder: (context, setState) {
184-
return ConfirmationDialog(
185-
title: "Stop Recording?",
186-
description:
187-
"Are you sure you want to stop recording and summarise the conversation now?",
188-
checkboxValue: !showSummarizeConfirmation,
189-
checkboxText: "Don't ask me again",
190-
updateCheckboxValue: (value) {
191-
if (value != null) {
192-
setState(() {
193-
showSummarizeConfirmation = !value;
194-
});
195-
}
196-
},
197-
onCancel: () {
198-
Navigator.of(context).pop();
199-
},
200-
onConfirm: () {
201-
SharedPreferencesUtil().showSummarizeConfirmation =
202-
showSummarizeConfirmation;
203-
context.read<CaptureProvider>().createMemory();
204-
Navigator.of(context).pop();
205-
},
206-
);
155+
const SizedBox(
156+
height: 16,
157+
),
158+
],
159+
),
160+
),
161+
],
162+
),
163+
),
164+
),
165+
],
166+
),
167+
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
168+
floatingActionButton: provider.segments.isEmpty
169+
? const SizedBox()
170+
: Column(
171+
mainAxisSize: MainAxisSize.min,
172+
children: [
173+
AnimatedContainer(
174+
duration: const Duration(milliseconds: 200),
175+
height: _controller?.index == 0 ? 0 : 30,
176+
child: Text(
177+
provider.segments.isEmpty ? '' : provider.segments.last.getTimestampString().split(' - ')[1],
178+
style: const TextStyle(fontSize: 16, color: Colors.white),
179+
),
180+
),
181+
Container(
182+
height: 60,
183+
width: 60,
184+
margin: const EdgeInsets.only(bottom: 10),
185+
decoration: const BoxDecoration(
186+
color: Colors.red,
187+
shape: BoxShape.circle,
188+
),
189+
child: InkWell(
190+
onTap: () {
191+
if (provider.segments.isNotEmpty) {
192+
if (!showSummarizeConfirmation) {
193+
context.read<CaptureProvider>().createMemory();
194+
return;
195+
}
196+
showDialog(
197+
context: context,
198+
builder: (context) {
199+
return StatefulBuilder(
200+
builder: (context, setState) {
201+
return ConfirmationDialog(
202+
title: "Finished Conversation?",
203+
description:
204+
"Are you sure you want to stop recording and summarize the conversation now?",
205+
checkboxValue: !showSummarizeConfirmation,
206+
checkboxText: "Don't ask me again",
207+
updateCheckboxValue: (value) {
208+
if (value != null) {
209+
setState(() {
210+
showSummarizeConfirmation = !value;
207211
});
208-
});
212+
}
213+
},
214+
onCancel: () {
215+
Navigator.of(context).pop();
216+
},
217+
onConfirm: () {
218+
SharedPreferencesUtil().showSummarizeConfirmation =
219+
showSummarizeConfirmation;
220+
context.read<CaptureProvider>().createMemory();
221+
Navigator.of(context).pop();
222+
Navigator.of(context).pop();
223+
},
224+
);
209225
},
210-
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
211-
child: const Padding(
212-
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 0),
213-
child: Text(
214-
'Stop Recording',
215-
style: TextStyle(
216-
color: Colors.white,
217-
fontSize: 16,
218-
),
219-
),
220-
),
221-
),
222-
),
223-
],
226+
);
227+
});
228+
}
229+
},
230+
child: const Icon(
231+
Icons.stop,
232+
color: Colors.white,
233+
size: 34,
234+
),
224235
),
225236
),
226237
],
227238
),
228-
),
229-
),
230-
],
231239
),
232-
),
233-
);
234-
});
240+
);
241+
},
242+
);
235243
}
236244
}
245+
246+
String transcriptElapsedTime(String timepstamp) {
247+
timepstamp = timepstamp.split(' - ')[1];
248+
return timepstamp;
249+
}

app/lib/widgets/confirmation_dialog.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class ConfirmationDialog extends StatelessWidget {
8181
Text(
8282
description,
8383
textAlign: TextAlign.center,
84+
style: const TextStyle(fontSize: 14),
8485
),
8586
const SizedBox(height: 16),
8687
Row(
@@ -103,11 +104,11 @@ class ConfirmationDialog extends StatelessWidget {
103104
actions: [
104105
CupertinoDialogAction(
105106
onPressed: onCancel,
106-
child: Text(cancelText ?? "Cancel", style: const TextStyle(color: Colors.white)),
107+
child: Text(cancelText ?? "Cancel", style: const TextStyle(color: Colors.white, fontSize: 14)),
107108
),
108109
CupertinoDialogAction(
109110
onPressed: onConfirm,
110-
child: Text(confirmText ?? "Confirm", style: const TextStyle(color: Colors.white)),
111+
child: Text(confirmText ?? "Confirm", style: const TextStyle(color: Colors.white, fontSize: 14)),
111112
),
112113
],
113114
);

0 commit comments

Comments
 (0)