-
Notifications
You must be signed in to change notification settings - Fork 5
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
Polls #33
base: release24
Are you sure you want to change the base?
Polls #33
Conversation
Add Polls Calendar UI update
|
} | ||
|
||
@DataClassName('FileDB') | ||
class FileTable extends Table { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if file message deleted? why not using foreign key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix changes, Also make sure to have smaller PR's next time : making it easier to review.
]; | ||
|
||
Map<String, Color> getDpColours(String name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function create a DP with a random background color and name initial for the Users which dont have a dp ?
class ProfilePicture extends StatelessWidget { | ||
final String dp, name; | ||
final double size; | ||
|
||
const ProfilePicture( | ||
{super.key, required this.dp, required this.name, this.size = 20}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Map<String, Color> colours = getDpColours(name); | ||
Color backgroundColour = colours['background']!; | ||
Color textColour = colours['text']!; | ||
|
||
double width = size * 2.0; | ||
return Container( | ||
clipBehavior: Clip.hardEdge, | ||
constraints: BoxConstraints( | ||
minWidth: width, minHeight: width, maxHeight: width, maxWidth: width), | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(15), color: backgroundColour), | ||
child: CachedNetworkImage( | ||
imageUrl: dp, | ||
fit: BoxFit.cover, | ||
errorWidget: (_, __, ___) => Center( | ||
child: Text( | ||
name.substring(0, 1).toUpperCase(), | ||
style: TextStyle( | ||
fontWeight: FontWeight.bold, fontSize: size, color: textColour), | ||
)), | ||
), | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will remove the DP image or default_dp logic from the UI, your build
function should ideally:
If : DP is filepath is present -> Fetch the DP from local storage or network
else : Display the text w the background (default DP)
And then build the container.
[Discuss with @Alok1721 ]
import 'package:zineapp2023/theme/color.dart'; | ||
import 'package:zineapp2023/screens/chat/chat_screen/chat_room.dart'; | ||
|
||
class ChatDescription extends StatelessWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add in-code doc for the functionality of the class
required this.roomName, | ||
required this.data, | ||
required this.image, | ||
super.key, | ||
}); | ||
|
||
final String roomName; | ||
final dynamic image; | ||
List<ActiveMember> data; | ||
final String image; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is image_url or file-path make sure the variable name reflets the same intent.
import 'package:zineapp2023/screens/chat/chat_screen/view_model/chat_room_view_model.dart'; | ||
import 'package:zineapp2023/theme/color.dart'; | ||
|
||
class ReplyCard extends StatelessWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add in-code doc for the new class added
Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(10), | ||
border: Border.all(color: Colors.black38)), | ||
padding: const EdgeInsets.only(left: 5, right: 5), | ||
width: double.infinity, | ||
child: Column(children: [ | ||
TextField( | ||
controller: _titleController, | ||
decoration: InputDecoration(hintText: "Title"), | ||
), | ||
|
||
..._controllers.map( | ||
(controller) => PollOption( | ||
controller: controller, | ||
onDelete: onDelete, | ||
), | ||
), | ||
|
||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Flexible( | ||
flex: 9, | ||
child: IconButton( | ||
onPressed: () => setState(() { | ||
_controllers | ||
.add(TextEditingController()); | ||
}), | ||
icon: Icon(Icons.add))), | ||
Flexible( | ||
flex: 3, | ||
child: InkWell( | ||
onTap: () { | ||
if (kDebugMode) { | ||
print('inSendPoll'); | ||
} | ||
chatVm.sendPoll( | ||
_titleController.text, | ||
_controllers | ||
.map( | ||
(TextEditingController | ||
controller) => | ||
controller.text, | ||
) | ||
.toList()); | ||
}, | ||
child: SizedBox( | ||
height: 50, | ||
child: Center(child: Text('Send Poll')), | ||
), | ||
), | ||
), | ||
], | ||
) | ||
// FormField(builder: builder) | ||
])) | ||
], | ||
), | ||
)), | ||
const SizedBox( | ||
height: 5, | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class PollOption extends StatelessWidget { | ||
final TextEditingController controller; | ||
final Function(TextEditingController) onDelete; | ||
const PollOption( | ||
{super.key, required this.controller, required this.onDelete}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: [ | ||
Expanded( | ||
child: Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: TextFormField( | ||
controller: controller, | ||
decoration: InputDecoration(hintText: 'Option'), | ||
), | ||
), | ||
), | ||
IconButton( | ||
onPressed: () { | ||
onDelete(controller); | ||
}, | ||
icon: Icon( | ||
Icons.cancel, | ||
color: greyText, | ||
)) | ||
], | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we able to add multiple options in the polls ?
// // print(tasks); | ||
|
||
// Above code just set User's links to empty, if the key wasnt created | ||
|
||
UserModel userMod = UserModel( | ||
uid: uid, | ||
id: user['id'], | ||
email: user['email'], | ||
name: user['name'], | ||
dp: user['dpUrl'] ?? "1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename var to dpUrl if a filePath, applicable everywhere.
Add Polls
Calendar UI update## Description
Fixes #(issue number)
Type of Change
Changes Made
Screenshots (if applicable)
How to Test
Additional Notes