Skip to content

Commit

Permalink
Move stop memory button to bottom center (#959)
Browse files Browse the repository at this point in the history
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
-->
  • Loading branch information
josancamon19 authored Oct 2, 2024
2 parents 1307d15 + ff17c29 commit e1619fd
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 172 deletions.
353 changes: 183 additions & 170 deletions app/lib/pages/memory_capturing/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,191 +46,204 @@ class _MemoryCapturingPageState extends State<MemoryCapturingPage> with TickerPr

@override
Widget build(BuildContext context) {
return Consumer2<CaptureProvider, DeviceProvider>(builder: (context, provider, deviceProvider, child) {
// Track memory
if ((provider.memoryProvider?.memories ?? []).isNotEmpty &&
(provider.memoryProvider!.memories.first.id != widget.topMemoryId || widget.topMemoryId == null)) {
_pushNewMemory(context, provider.memoryProvider!.memories.first);
}
return Consumer2<CaptureProvider, DeviceProvider>(
builder: (context, provider, deviceProvider, child) {
// Track memory
if ((provider.memoryProvider?.memories ?? []).isNotEmpty &&
(provider.memoryProvider!.memories.first.id != widget.topMemoryId || widget.topMemoryId == null)) {
_pushNewMemory(context, provider.memoryProvider!.memories.first);
}

// Memory source
var memorySource = MemorySource.friend;
// var captureProvider = context.read<CaptureProvider>();
// if (captureProvider.isGlasses) {
// memorySource = MemorySource.openglass;
// }
return PopScope(
canPop: true,
child: Scaffold(
key: scaffoldKey,
backgroundColor: Theme.of(context).colorScheme.primary,
appBar: AppBar(
automaticallyImplyLeading: false,
// Memory source
var memorySource = MemorySource.friend;
// var captureProvider = context.read<CaptureProvider>();
// if (captureProvider.isGlasses) {
// memorySource = MemorySource.openglass;
// }
return PopScope(
canPop: true,
child: Scaffold(
key: scaffoldKey,
backgroundColor: Theme.of(context).colorScheme.primary,
title: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
onPressed: () {
Navigator.pop(context);
return;
},
icon: const Icon(Icons.arrow_back_rounded, size: 24.0),
),
const SizedBox(width: 4),
const Text("🎙️"),
const SizedBox(width: 4),
const Expanded(child: Text("In progress")),
],
),
),
body: Column(
children: [
TabBar(
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: memorySource == MemorySource.openglass
? 'Photos'
: memorySource == MemorySource.screenpipe
? 'Raw Data'
: 'Transcript',
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Theme.of(context).colorScheme.primary,
title: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
onPressed: () {
Navigator.pop(context);
return;
},
icon: const Icon(Icons.arrow_back_rounded, size: 24.0),
),
const Tab(text: 'Summary')
const SizedBox(width: 4),
const Text("🎙️"),
const SizedBox(width: 4),
const Expanded(child: Text("In progress")),
],
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: [
provider.segments.isEmpty
? Column(
children: [
const SizedBox(height: 80),
Center(
child: Text(memorySource == MemorySource.friend ? "No transcript" : "Empty")),
],
)
: getTranscriptWidget(
provider.memoryCreating,
provider.segments,
[],
deviceProvider.connectedDevice,
)
],
),
Padding(
padding: const EdgeInsets.only(top: 140),
child: ListView(
),
body: Column(
children: [
TabBar(
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: memorySource == MemorySource.openglass
? 'Photos'
: memorySource == MemorySource.screenpipe
? 'Raw Data'
: 'Transcript',
),
const Tab(text: '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: [
const SizedBox(height: 80),
Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Text(
provider.segments.isEmpty
? "No summary"
: "We summarize conversations 2 minutes after they end\n\nWant to end it now?",
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16),
provider.segments.isEmpty
? Column(
children: [
const SizedBox(height: 80),
Center(
child: Text(memorySource == MemorySource.friend ? "No transcript" : "Empty")),
],
)
: getTranscriptWidget(
provider.memoryCreating,
provider.segments,
[],
deviceProvider.connectedDevice,
)
],
),
Padding(
padding: const EdgeInsets.only(top: 140),
child: ListView(
shrinkWrap: true,
children: [
const SizedBox(height: 80),
Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Text(
provider.segments.isEmpty
? "No summary"
: "Conversation is summarized after 2 minutes of no speech 🤫",
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16),
),
),
),
),
const SizedBox(
height: 16,
),
provider.segments.isEmpty
? const SizedBox()
: Container(
decoration: BoxDecoration(
border: const GradientBoxBorder(
gradient: LinearGradient(colors: [
Color.fromARGB(127, 208, 208, 208),
Color.fromARGB(127, 188, 99, 121),
Color.fromARGB(127, 86, 101, 182),
Color.fromARGB(127, 126, 190, 236)
]),
width: 2,
),
borderRadius: BorderRadius.circular(12),
),
margin: const EdgeInsets.symmetric(horizontal: 48),
child: MaterialButton(
onPressed: () async {
print(showSummarizeConfirmation);
if (!showSummarizeConfirmation) {
context.read<CaptureProvider>().createMemory();
return;
}
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(builder: (context, setState) {
return ConfirmationDialog(
title: "Stop Recording?",
description:
"Are you sure you want to stop recording and summarise the conversation now?",
checkboxValue: !showSummarizeConfirmation,
checkboxText: "Don't ask me again",
updateCheckboxValue: (value) {
if (value != null) {
setState(() {
showSummarizeConfirmation = !value;
});
}
},
onCancel: () {
Navigator.of(context).pop();
},
onConfirm: () {
SharedPreferencesUtil().showSummarizeConfirmation =
showSummarizeConfirmation;
context.read<CaptureProvider>().createMemory();
Navigator.of(context).pop();
},
);
const SizedBox(
height: 16,
),
],
),
),
],
),
),
),
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: provider.segments.isEmpty
? const SizedBox()
: Column(
mainAxisSize: MainAxisSize.min,
children: [
AnimatedContainer(
duration: const Duration(milliseconds: 200),
height: _controller?.index == 0 ? 0 : 30,
child: Text(
provider.segments.isEmpty ? '' : provider.segments.last.getTimestampString().split(' - ')[1],
style: const TextStyle(fontSize: 16, color: Colors.white),
),
),
Container(
height: 60,
width: 60,
margin: const EdgeInsets.only(bottom: 10),
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
child: InkWell(
onTap: () {
if (provider.segments.isNotEmpty) {
if (!showSummarizeConfirmation) {
context.read<CaptureProvider>().createMemory();
return;
}
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return ConfirmationDialog(
title: "Finished Conversation?",
description:
"Are you sure you want to stop recording and summarize the conversation now?",
checkboxValue: !showSummarizeConfirmation,
checkboxText: "Don't ask me again",
updateCheckboxValue: (value) {
if (value != null) {
setState(() {
showSummarizeConfirmation = !value;
});
});
}
},
onCancel: () {
Navigator.of(context).pop();
},
onConfirm: () {
SharedPreferencesUtil().showSummarizeConfirmation =
showSummarizeConfirmation;
context.read<CaptureProvider>().createMemory();
Navigator.of(context).pop();
Navigator.of(context).pop();
},
);
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 0),
child: Text(
'Stop Recording',
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
),
),
),
],
);
});
}
},
child: const Icon(
Icons.stop,
color: Colors.white,
size: 34,
),
),
),
],
),
),
),
],
),
),
);
});
);
},
);
}
}

String transcriptElapsedTime(String timepstamp) {
timepstamp = timepstamp.split(' - ')[1];
return timepstamp;
}
5 changes: 3 additions & 2 deletions app/lib/widgets/confirmation_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ConfirmationDialog extends StatelessWidget {
Text(
description,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 14),
),
const SizedBox(height: 16),
Row(
Expand All @@ -103,11 +104,11 @@ class ConfirmationDialog extends StatelessWidget {
actions: [
CupertinoDialogAction(
onPressed: onCancel,
child: Text(cancelText ?? "Cancel", style: const TextStyle(color: Colors.white)),
child: Text(cancelText ?? "Cancel", style: const TextStyle(color: Colors.white, fontSize: 14)),
),
CupertinoDialogAction(
onPressed: onConfirm,
child: Text(confirmText ?? "Confirm", style: const TextStyle(color: Colors.white)),
child: Text(confirmText ?? "Confirm", style: const TextStyle(color: Colors.white, fontSize: 14)),
),
],
);
Expand Down

0 comments on commit e1619fd

Please sign in to comment.