Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

En/bottom nav bar #13

Open
wants to merge 3 commits into
base: satyam
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Future<Uint8List> getImage() async {
Uri.https(apiConstant, 'v1/randomimage', {'category': 'technology'});
final response = await http.get(
url,
headers: {'X-Api-Key': 'hyycFNEH/Vm8bgpyjZ+eMQ==LUHnunq2o4QrWbr3'},
headers: {'X-Api-Key': '+PVSQ6phxAnKHW4J4oz+7A==z4NR1q5X6DZ8RBDa'},
);

if (response.statusCode == 200) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class _CaptureMemoryPageState extends State<CaptureMemoryPage> {
memoryBloc: _memoryBloc,
),
const SizedBox(height: 8),
//*-- Capture --//
CaptureCard(
context: context,
hasTranscripts: widget.hasTranscripts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class _ChatPageTestState extends State<ChatPageTest>
padding: const EdgeInsets.only(
left: 20,
right: 20,
bottom: 200,
bottom: 100,
),
itemCount: state.messages?.length ?? 0,
itemBuilder: (context, index) {
Expand Down Expand Up @@ -122,7 +122,8 @@ class _ChatPageTestState extends State<ChatPageTest>
margin: EdgeInsets.only(
left: 18,
right: 18,
bottom: widget.textFieldFocusNode.hasFocus ? 40 : 120,
bottom: 18,
// bottom: widget.textFieldFocusNode.hasFocus ? 40 : 120,
),
decoration: BoxDecoration(
color: Colors.black,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:friend_private/backend/database/memory.dart';
import 'package:friend_private/features/memory/presentation/bloc/memory_bloc.dart';
import 'package:friend_private/features/memory/presentation/widgets/action_tab.dart';
import 'package:friend_private/features/memory/presentation/widgets/event_tab.dart';
import 'package:friend_private/features/memory/presentation/widgets/summary_tab.dart';
import 'package:friend_private/features/memory/presentation/widgets/transcript_tab.dart';
import 'package:friend_private/pages/home/backgrund_scafold.dart';
import 'package:friend_private/pages/memory_detail/enable_title.dart';
import 'package:friend_private/pages/memory_detail/share.dart';
import 'package:friend_private/pages/memory_detail/widgets.dart';
import 'package:friend_private/utils/memories/reprocess.dart';
import 'package:friend_private/utils/other/temp.dart';

class CustomMemoryDetailPage extends StatefulWidget {
const CustomMemoryDetailPage({
Expand Down Expand Up @@ -37,7 +41,7 @@ class _CustomMemoryDetailPageState extends State<CustomMemoryDetailPage> {
);
},
child: DefaultTabController(
length: 2,
length: 4,
initialIndex: 1,
child: CustomScaffold(
backgroundColor: Colors.transparent,
Expand Down Expand Up @@ -68,32 +72,117 @@ class _CustomMemoryDetailPageState extends State<CustomMemoryDetailPage> {
elevation: 0,
title: Text(
"${widget.memoryBloc.state.memories[widget.memoryAtIndex].structured.target!.getEmoji()}"),
bottom: const TabBar(
tabs: [
Tab(text: 'Transcript'),
Tab(text: 'Summary'),
],
),
),
body: BlocBuilder<MemoryBloc, MemoryState>(
bloc: widget.memoryBloc,
builder: (context, state) {
return TabBarView(
print('memory Details Page ${state.toString()}');
final selectedMemory = state.memories[state.memoryIndex];

final structured = selectedMemory.structured.target!;
final time = selectedMemory.startedAt == null
? dateTimeFormat('h:mm a', selectedMemory.createdAt)
: '${dateTimeFormat('h:mm a', selectedMemory.startedAt)} to ${dateTimeFormat('h:mm a', selectedMemory.finishedAt)}';
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TranscriptTab(
pageController: pageController,
memoryAtIndex: state.memoryIndex,
memoryBloc: widget.memoryBloc,
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'${dateTimeFormat('MMM d, yyyy', selectedMemory.createdAt)} '
'${selectedMemory.startedAt == null ? 'at' : 'from'} $time',
style: const TextStyle(color: Colors.grey, fontSize: 16),
),
),
// SummaryTab(
// memoryBloc: widget.memoryBloc,
// memoryAtIndex: state.memoryIndex,
// ),
SummaryTab(
pageController: pageController,
memoryAtIndex: state.memoryIndex,
memoryBloc: widget.memoryBloc,
const SizedBox(height: 16),
selectedMemory.discarded
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'Discarded Memory',
style: Theme.of(context).textTheme.titleLarge,
),
)
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: EditableTitle(
initialText: structured.title,
onTextChanged: (String newTitle) {
structured.title = newTitle;
widget.memoryBloc
.add(UpdatedMemory(structured: structured));
},
discarded: selectedMemory.discarded,
style: Theme.of(context).textTheme.titleLarge!,
),
),
const SizedBox(height: 16),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: const Color.fromARGB(255, 29, 29, 29),
),
margin:
const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
// color: const Color.fromARGB(75, 242, 242, 242),

child: SizedBox(
height: 40,
child: TabBar(
dividerColor: Colors.transparent,
padding: const EdgeInsets.symmetric(
vertical: 4, horizontal: 4),
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Colors.white,
unselectedLabelColor: Colors.grey,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(
6,
),
color: const Color.fromARGB(125, 158, 158, 158),
),
indicatorWeight: 0,
labelPadding: EdgeInsets.zero,
tabs: const [
Tab(text: 'Transcript'),
Tab(text: 'Summary'),
Tab(text: 'Action'),
Tab(text: 'Events'),
],
),
),
),
Expanded(
child: TabBarView(
children: [
TranscriptTab(
pageController: pageController,
memoryAtIndex: state.memoryIndex,
memoryBloc: widget.memoryBloc,
),
// SummaryTab(
// memoryBloc: widget.memoryBloc,
// memoryAtIndex: state.memoryIndex,
// ),
SummaryTab(
pageController: pageController,
memoryAtIndex: state.memoryIndex,
memoryBloc: widget.memoryBloc,
),
ActionTab(
pageController: pageController,
memoryAtIndex: state.memoryIndex,
memoryBloc: widget.memoryBloc,
),
EventTab(
pageController: pageController,
memoryAtIndex: state.memoryIndex,
memoryBloc: widget.memoryBloc,
)
],
),
)
],
);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:friend_private/backend/database/memory_provider.dart';
import 'package:friend_private/backend/mixpanel.dart';
import 'package:friend_private/features/memory/presentation/bloc/memory_bloc.dart';
import 'package:friend_private/utils/other/temp.dart';

class ActionTab extends StatefulWidget {
const ActionTab(
{super.key,
required this.memoryAtIndex,
required this.memoryBloc,
required this.pageController});
final int memoryAtIndex;
final MemoryBloc memoryBloc;
final PageController pageController;

@override
State<ActionTab> createState() => _ActionTabState();
}

class _ActionTabState extends State<ActionTab> {
@override
Widget build(BuildContext context) {
return BlocBuilder<MemoryBloc, MemoryState>(
builder: (context, state) {
final selectedMemory = state.memories[state.memoryIndex];
final structured = state.memories[state.memoryIndex].structured.target!;

if (state.status == MemoryStatus.success) {
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16,vertical: 12),
child: Column(
children: [
structured.actionItems.isNotEmpty
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Action Items',
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(fontSize: 26),
),
IconButton(
onPressed: () {
Clipboard.setData(ClipboardData(
text:
'- ${structured.actionItems.map((e) => e.description).join('\n- ')}'));
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(
content: Text('Action items copied to clipboard'),
duration: Duration(seconds: 2),
));
MixpanelManager().copiedMemoryDetails(
selectedMemory,
source: 'Action Items');
},
icon: const Icon(Icons.copy_rounded,
color: Colors.white, size: 20),
)
],
)
: const SizedBox(
height: 400,
child: Center(
child: Text("Oops! This Memory Don't have Action")),
),
...structured.actionItems.map<Widget>(
(item) {
return Padding(
padding: const EdgeInsets.only(top: 10),
child: ListTile(
onTap: () {
setState(() {
item.completed = !item.completed;
MemoryProvider().updateActionItem(item);
});
},
contentPadding: EdgeInsets.zero,
leading: Icon(
color: item.completed ? Colors.green : Colors.grey,
item.completed ? Icons.task_alt : Icons.circle_outlined,
size: 20,
),
title: Text(
item.description,
style: TextStyle(
color: Colors.grey.shade300,
fontSize: 16,
height: 1.3,
),
),
),
);
},
),
],
),
),
);
}
return const SizedBox.shrink();
},
);
}
}
Loading