-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/MoazSayed7/Flutter-Chat-App…
- Loading branch information
Showing
2 changed files
with
122 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:chat_bubbles/algo/algo.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
///[DateChip] use to show the date breakers on the chat view | ||
///[date] parameter is required | ||
///[color] parameter is optional default color code `8AD3D5` | ||
/// | ||
/// | ||
class DateChip extends StatelessWidget { | ||
final DateTime date; | ||
final Color color; | ||
final Color dateColor; | ||
|
||
/// | ||
/// | ||
/// | ||
const DateChip({ | ||
Key? key, | ||
required this.date, | ||
this.color = const Color(0x558AD3D5), | ||
this.dateColor = const Color(0x558AD3D5), | ||
}) : super(key: key); | ||
@override | ||
Widget build(BuildContext context) { | ||
return Center( | ||
child: Padding( | ||
padding: const EdgeInsets.only( | ||
top: 7, | ||
bottom: 7, | ||
), | ||
child: Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.all(Radius.circular(6)), | ||
color: color, | ||
), | ||
child: Padding( | ||
padding: const EdgeInsets.all(5.0), | ||
child: Text( | ||
Algo.dateChipText(date), | ||
style: TextStyle( | ||
color: dateColor, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |