Merge branch 'master' into fatima
commit
1c750a4084
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
|
||||
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
|
||||
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
|
||||
<path style="fill:#F15642;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
|
||||
V416z"/>
|
||||
<g>
|
||||
<path style="fill:#FFFFFF;" d="M88.368,384c-4.096-2.304-6.656-6.912-4.096-12.288l36.72-71.744c3.456-6.784,12.656-7.04,15.856,0
|
||||
l36.08,71.744c5.248,9.984-10.24,17.904-14.848,7.936l-5.632-11.248h-47.2l-5.52,11.248C97.712,384,92.992,384.912,88.368,384z
|
||||
M143.392,351.52l-14.464-31.616l-15.744,31.616H143.392z"/>
|
||||
<path style="fill:#FFFFFF;" d="M189.184,384c-4.096-2.304-6.656-6.912-4.096-12.288l36.704-71.744
|
||||
c3.456-6.784,12.672-7.04,15.872,0l36.064,71.744c5.248,9.984-10.24,17.904-14.832,7.936l-5.648-11.248h-47.2l-5.504,11.248
|
||||
C198.512,384,193.776,384.912,189.184,384z M244.192,351.52l-14.448-31.616l-15.728,31.616H244.192z"/>
|
||||
<path style="fill:#FFFFFF;" d="M282.416,339.088c0-24.688,15.488-45.904,44.912-45.904c11.136,0,19.952,3.312,29.296,11.376
|
||||
c3.456,3.184,3.84,8.832,0.384,12.4c-3.456,3.056-8.704,2.688-11.76-0.368c-5.248-5.504-10.624-7.024-17.92-7.024
|
||||
c-19.696,0-29.168,13.936-29.168,29.536c0,15.872,9.344,30.464,29.168,30.464c7.296,0,14.08-2.96,19.952-8.192
|
||||
c3.968-3.072,9.472-1.552,11.776,1.536c2.048,2.816,3.056,7.536-1.408,12.016c-8.96,8.336-19.696,9.984-30.336,9.984
|
||||
C296.368,384.912,282.416,363.792,282.416,339.088z"/>
|
||||
</g>
|
||||
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.616,14.4,32,32,32h320c17.6,0,32-14.384,32-32V128L352,0H128z
|
||||
"/>
|
||||
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
|
||||
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
|
||||
<path style="fill:#50BEE8;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
|
||||
V416z"/>
|
||||
<g>
|
||||
<path style="fill:#FFFFFF;" d="M117.184,327.84v47.344c0,5.632-4.592,8.832-9.216,8.832c-4.096,0-7.664-3.2-7.664-8.832v-72.032
|
||||
c0-6.64,5.632-8.832,7.664-8.832c3.712,0,5.888,2.192,8.064,4.608l28.16,38l29.152-39.408c4.24-5.248,14.592-3.2,14.592,5.632
|
||||
v72.032c0,5.632-3.6,8.832-7.68,8.832c-4.592,0-8.192-3.2-8.192-8.832V327.84l-21.232,26.88c-4.592,5.632-10.352,5.632-14.576,0
|
||||
L117.184,327.84z"/>
|
||||
<path style="fill:#FFFFFF;" d="M210.288,303.152c0-4.224,3.328-8.832,8.704-8.832h29.552c16.64,0,31.616,11.136,31.616,32.496
|
||||
c0,20.224-14.976,31.472-31.616,31.472h-21.36v16.896c0,5.632-3.584,8.832-8.192,8.832c-4.224,0-8.704-3.2-8.704-8.832V303.152z
|
||||
M227.168,310.448v31.856h21.36c8.576,0,15.36-7.552,15.36-15.488c0-8.96-6.784-16.368-15.36-16.368L227.168,310.448
|
||||
L227.168,310.448z"/>
|
||||
<path style="fill:#FFFFFF;" d="M322.064,311.472h-21.872c-10.736,0-10.096-15.984,0-15.984h39.152c7.792,0,11.376,8.96,5.632,14.72
|
||||
l-21.232,19.824c15.616-1.152,27.888,10.48,27.888,24.816c0,15.728-11.136,29.168-34.544,29.168
|
||||
c-10.24,0-20.336-4.224-26.224-13.44c-6.144-9.072,7.024-17.776,13.936-8.832c3.328,4.352,8.704,6.528,14.448,6.528
|
||||
c7.808,0,15.488-3.328,15.488-13.44c0-13.296-16.256-11.248-25.072-10.352c-10.752,2.048-13.936-9.6-7.664-14.448L322.064,311.472z
|
||||
"/>
|
||||
</g>
|
||||
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 163 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,189 @@
|
||||
import 'dart:math';
|
||||
import 'package:audio_waveforms/audio_waveforms.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
|
||||
class SeekBar extends StatefulWidget {
|
||||
final Duration duration;
|
||||
final Duration position;
|
||||
final Duration bufferedPosition;
|
||||
final ValueChanged<Duration>? onChanged;
|
||||
final ValueChanged<Duration>? onChangeEnd;
|
||||
|
||||
const SeekBar({
|
||||
Key? key,
|
||||
required this.duration,
|
||||
required this.position,
|
||||
required this.bufferedPosition,
|
||||
this.onChanged,
|
||||
this.onChangeEnd,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
SeekBarState createState() => SeekBarState();
|
||||
}
|
||||
|
||||
class SeekBarState extends State<SeekBar> {
|
||||
double? _dragValue;
|
||||
late SliderThemeData _sliderThemeData;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
_sliderThemeData = SliderTheme.of(context).copyWith(
|
||||
// trackHeight: 2.0,
|
||||
thumbColor: MyColors.lightGreenColor,
|
||||
activeTrackColor: MyColors.lightGreenColor,
|
||||
inactiveTrackColor: MyColors.grey57Color.withOpacity(0.4),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
SliderTheme(
|
||||
data: _sliderThemeData.copyWith(
|
||||
thumbShape: HiddenThumbComponentShape(),
|
||||
),
|
||||
child: ExcludeSemantics(
|
||||
child: Slider(
|
||||
min: 0.0,
|
||||
max: widget.duration.inMilliseconds.toDouble(),
|
||||
value: min(widget.bufferedPosition.inMilliseconds.toDouble(), widget.duration.inMilliseconds.toDouble()),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_dragValue = value;
|
||||
});
|
||||
if (widget.onChanged != null) {
|
||||
widget.onChanged!(Duration(milliseconds: value.round()));
|
||||
}
|
||||
},
|
||||
onChangeEnd: (value) {
|
||||
if (widget.onChangeEnd != null) {
|
||||
widget.onChangeEnd!(Duration(milliseconds: value.round()));
|
||||
}
|
||||
_dragValue = null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SliderTheme(
|
||||
data: _sliderThemeData.copyWith(
|
||||
inactiveTrackColor: Colors.transparent,
|
||||
),
|
||||
child: Slider(
|
||||
min: 0.0,
|
||||
max: widget.duration.inMilliseconds.toDouble(),
|
||||
value: min(_dragValue ?? widget.position.inMilliseconds.toDouble(), widget.duration.inMilliseconds.toDouble()),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_dragValue = value;
|
||||
});
|
||||
if (widget.onChanged != null) {
|
||||
widget.onChanged!(Duration(milliseconds: value.round()));
|
||||
}
|
||||
},
|
||||
onChangeEnd: (value) {
|
||||
if (widget.onChangeEnd != null) {
|
||||
widget.onChangeEnd!(Duration(milliseconds: value.round()));
|
||||
}
|
||||
_dragValue = null;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PositionData {
|
||||
final Duration position;
|
||||
final Duration bufferedPosition;
|
||||
final Duration duration;
|
||||
|
||||
PositionData(this.position, this.bufferedPosition, this.duration);
|
||||
}
|
||||
|
||||
class HiddenThumbComponentShape extends SliderComponentShape {
|
||||
@override
|
||||
Size getPreferredSize(bool isEnabled, bool isDiscrete) => Size.zero;
|
||||
|
||||
@override
|
||||
void paint(
|
||||
PaintingContext context,
|
||||
Offset center, {
|
||||
required Animation<double> activationAnimation,
|
||||
required Animation<double> enableAnimation,
|
||||
required bool isDiscrete,
|
||||
required TextPainter labelPainter,
|
||||
required RenderBox parentBox,
|
||||
required SliderThemeData sliderTheme,
|
||||
required TextDirection textDirection,
|
||||
required double value,
|
||||
required double textScaleFactor,
|
||||
required Size sizeWithOverflow,
|
||||
}) {}
|
||||
}
|
||||
|
||||
class WaveBubble extends StatelessWidget {
|
||||
final PlayerController playerController;
|
||||
final VoidCallback onTap;
|
||||
final bool isPlaying;
|
||||
|
||||
const WaveBubble({
|
||||
Key? key,
|
||||
required this.playerController,
|
||||
required this.onTap,
|
||||
required this.isPlaying,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
gradient: const LinearGradient(
|
||||
transform: GradientRotation(.83),
|
||||
begin: Alignment.topRight,
|
||||
end: Alignment.bottomLeft,
|
||||
colors: <Color>[
|
||||
MyColors.gradiantEndColor,
|
||||
MyColors.gradiantStartColor,
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: onTap,
|
||||
icon: Icon(isPlaying ? Icons.stop : Icons.play_arrow),
|
||||
color: Colors.white,
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
),
|
||||
AudioFileWaveforms(
|
||||
size: Size(MediaQuery.of(context).size.width / 2, 10),
|
||||
playerController: playerController,
|
||||
padding: EdgeInsets.zero,
|
||||
margin: EdgeInsets.zero,
|
||||
enableSeekGesture: true,
|
||||
density: 1,
|
||||
playerWaveStyle: const PlayerWaveStyle(
|
||||
fixedWaveColor: Colors.white,
|
||||
liveWaveColor: MyColors.greenColor,
|
||||
showTop: true,
|
||||
showBottom: true,
|
||||
waveCap: StrokeCap.round,
|
||||
seekLineThickness: 2,
|
||||
visualizerHeight: 4,
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
|
||||
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/config/routes.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
|
||||
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyTeamScreen extends StatefulWidget {
|
||||
const MyTeamScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MyTeamScreen> createState() => _MyTeamScreenState();
|
||||
}
|
||||
|
||||
class _MyTeamScreenState extends State<MyTeamScreen> {
|
||||
late ChatProviderModel provider;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
provider = Provider.of<ChatProviderModel>(context, listen: false);
|
||||
loadMembers();
|
||||
}
|
||||
|
||||
|
||||
void loadMembers(){
|
||||
provider.getTeamMembers();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: MyColors.white,
|
||||
body: Consumer<ChatProviderModel>(
|
||||
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
|
||||
if (m.isLoading) {
|
||||
return ChatHomeShimmer(
|
||||
isDetailedScreen: false,
|
||||
);
|
||||
} else {
|
||||
return m.teamMembersList != null && m.teamMembersList.isNotEmpty
|
||||
? ListView.separated(
|
||||
itemCount: m.teamMembersList!.length,
|
||||
shrinkWrap: true,
|
||||
physics: const ClampingScrollPhysics(),
|
||||
padding: const EdgeInsets.only(bottom: 80.0),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return SizedBox(
|
||||
height: 55,
|
||||
child: Row(
|
||||
children: [
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
if (m.teamMembersList![index].isImageLoading!)
|
||||
const SizedBox(
|
||||
height: 48,
|
||||
width: 48,
|
||||
).toShimmer().circle(30),
|
||||
if (!m.teamMembersList![index].isImageLoading! && m.teamMembersList![index].userLocalDownlaodedImage == null)
|
||||
SvgPicture.asset(
|
||||
"assets/images/user.svg",
|
||||
height: 48,
|
||||
width: 48,
|
||||
),
|
||||
if (!m.teamMembersList![index].isImageLoading! && m.teamMembersList![index].userLocalDownlaodedImage != null)
|
||||
Container(
|
||||
width: 48.0,
|
||||
height: 48.0,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: FileImage(m.teamMembersList![index].userLocalDownlaodedImage!),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Positioned(
|
||||
// right: 5,
|
||||
// bottom: 1,
|
||||
// child: Container(
|
||||
// width: 10,
|
||||
// height: 10,
|
||||
// decoration: BoxDecoration(
|
||||
// color: m.teamMembersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
|
||||
// ),
|
||||
// ).circle(10),
|
||||
// )
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
(m.teamMembersList![index].userName! ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13),
|
||||
],
|
||||
).expanded,
|
||||
// SizedBox(
|
||||
// width: 60,
|
||||
// child: Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: <Widget>[
|
||||
// Icon(
|
||||
// m.teamMembersList![index].isFav! ? Icons.star : Icons.star_border,
|
||||
// color: m.teamMembersList![index].isFav! ? MyColors.yellowColor : MyColors.grey35Color,
|
||||
// ).onPress(() {
|
||||
// if (m.teamMembersList![index].isFav!) {
|
||||
// m.unFavoriteUser(
|
||||
// userID: AppState().chatDetails!.response!.id!,
|
||||
// targetUserID: m.teamMembersList![index].id!,
|
||||
// );
|
||||
// }
|
||||
// }).center,
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
).onPress(() {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.chatDetailed,
|
||||
arguments: ChatDetailedScreenParams(m.teamMembersList![index], true),
|
||||
).then(
|
||||
(Object? value) {
|
||||
m.clearSelections();
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) => const Divider(color: MyColors.lightGreyE5Color).paddingOnly(left: 70),
|
||||
).paddingAll(21)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
Utils.getNoDataWidget(context).expanded,
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DrawerItem extends StatefulWidget {
|
||||
final String title;
|
||||
final String subTitle;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
final dynamic assetLink;
|
||||
|
||||
const DrawerItem(this.title, {required this.icon, required this.color, this.subTitle = '', this.assetLink});
|
||||
|
||||
@override
|
||||
_DrawerItemState createState() => _DrawerItemState();
|
||||
}
|
||||
|
||||
class _DrawerItemState extends State<DrawerItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 0, bottom: 5, left: 0, right: 0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
if (widget.assetLink != null)
|
||||
Container(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: Image.asset(widget.assetLink),
|
||||
),
|
||||
if (widget.assetLink == null)
|
||||
Icon(
|
||||
widget.icon,
|
||||
color: widget.color,
|
||||
size: 25,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
child: Text(widget.title,
|
||||
style: TextStyle(
|
||||
color: widget.color ?? Color(0xFF2E303A),
|
||||
fontSize: 14,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.84,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,202 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_countdown_timer/current_remaining_time.dart';
|
||||
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/main.dart';
|
||||
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
|
||||
|
||||
class CountdownTimerForDetailScreen extends StatelessWidget {
|
||||
final int timeToMarathon;
|
||||
final MarathonProvider provider;
|
||||
|
||||
CountdownTimerForDetailScreen({
|
||||
Key? key,
|
||||
required this.provider,
|
||||
required this.timeToMarathon,
|
||||
}) : super(key: key);
|
||||
|
||||
final TextStyle styleTextHome = TextStyle(
|
||||
color: MyColors.white.withOpacity(0.45),
|
||||
fontStyle: FontStyle.italic,
|
||||
fontWeight: FontWeight.w800,
|
||||
letterSpacing: -0.4,
|
||||
);
|
||||
|
||||
final TextStyle styleDigitHome = TextStyle(
|
||||
height: 22 / 27,
|
||||
color: MyColors.white,
|
||||
fontSize: isTablet ? 30 : 15,
|
||||
fontStyle: FontStyle.italic,
|
||||
letterSpacing: -1.44,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
final TextStyle styleTextMarathon = const TextStyle(
|
||||
fontSize: 10,
|
||||
fontStyle: FontStyle.normal,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: MyColors.grey57Color,
|
||||
letterSpacing: -0.4,
|
||||
);
|
||||
|
||||
final TextStyle styleDigitMarathon = const TextStyle(
|
||||
height: 23 / 24,
|
||||
color: MyColors.darkTextColor,
|
||||
fontSize: 34,
|
||||
letterSpacing: -1.44,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
Widget buildSeparator() {
|
||||
return AutoSizeText(
|
||||
" : ",
|
||||
maxFontSize: 24,
|
||||
minFontSize: 20,
|
||||
style: styleDigitMarathon,
|
||||
);
|
||||
}
|
||||
|
||||
Widget getTimeDigit(String text) {
|
||||
return AutoSizeText(
|
||||
text,
|
||||
maxFontSize: 24,
|
||||
minFontSize: 20,
|
||||
style: styleDigitMarathon,
|
||||
);
|
||||
}
|
||||
|
||||
Widget getTimeText(String text) {
|
||||
return AutoSizeText(
|
||||
text,
|
||||
minFontSize: 7,
|
||||
maxFontSize: 8,
|
||||
style: styleTextMarathon,
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildEmptyWidget() {
|
||||
return Directionality(
|
||||
textDirection: ui.TextDirection.ltr,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
getTimeDigit("00"),
|
||||
getTimeText(LocaleKeys.days.tr()),
|
||||
],
|
||||
),
|
||||
buildSeparator(),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
getTimeDigit("00"),
|
||||
getTimeText(LocaleKeys.hours.tr()),
|
||||
],
|
||||
),
|
||||
buildSeparator(),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
getTimeDigit("00"),
|
||||
getTimeText(LocaleKeys.minutes.tr()),
|
||||
],
|
||||
),
|
||||
buildSeparator(),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
getTimeDigit("00"),
|
||||
getTimeText(LocaleKeys.seconds.tr()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildCountdownTimer(CurrentRemainingTime? time) {
|
||||
if (time == null) {
|
||||
if (!provider.itsMarathonTime) {
|
||||
scheduleMicrotask(() {
|
||||
provider.itsMarathonTime = true;
|
||||
provider.isButtonEnabled = true;
|
||||
provider.startTimerToWaitForMarathon();
|
||||
});
|
||||
}
|
||||
|
||||
return provider.itsMarathonTime
|
||||
? Directionality(
|
||||
textDirection: ui.TextDirection.ltr,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
getTimeDigit(provider.totalSecondsToWaitForMarathon.toString()),
|
||||
getTimeText(LocaleKeys.seconds.tr()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: buildEmptyWidget();
|
||||
}
|
||||
|
||||
return Directionality(
|
||||
textDirection: ui.TextDirection.ltr,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
time.days == null ? getTimeDigit("00") : getTimeDigit(time.days! < 10 ? "0${time.days.toString()}" : time.days.toString()),
|
||||
getTimeText(LocaleKeys.days.tr()),
|
||||
],
|
||||
),
|
||||
buildSeparator(),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
time.hours == null ? getTimeDigit("00") : getTimeDigit(time.hours! < 10 ? "0${time.hours.toString()}" : time.hours.toString()),
|
||||
getTimeText(LocaleKeys.hours.tr()),
|
||||
],
|
||||
),
|
||||
buildSeparator(),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
time.min == null ? getTimeDigit("00") : getTimeDigit(time.min! < 10 ? "0${time.min.toString()}" : time.min.toString()),
|
||||
getTimeText(LocaleKeys.minutes.tr()),
|
||||
],
|
||||
),
|
||||
buildSeparator(),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
time.sec == null ? getTimeDigit("00") : getTimeDigit(time.sec! < 10 ? "0${time.sec.toString()}" : time.sec.toString()),
|
||||
getTimeText(LocaleKeys.seconds.tr()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CountdownTimer(
|
||||
endTime: timeToMarathon,
|
||||
onEnd: null,
|
||||
widgetBuilder: (BuildContext context, CurrentRemainingTime? time) {
|
||||
return buildCountdownTimer(time);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
|
||||
import 'package:mohem_flutter_app/classes/lottie_consts.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
|
||||
class WinnerScreen extends StatelessWidget {
|
||||
const WinnerScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: MyColors.backgroundColor,
|
||||
appBar: AppBarWidget(context, title: LocaleKeys.brainMarathon.tr()),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
60.height,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: MyDecorations.shadowDecoration,
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 200,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Lottie.asset(
|
||||
MyLottieConsts.celebrate1Lottie,
|
||||
height: 200,
|
||||
),
|
||||
Lottie.asset(
|
||||
MyLottieConsts.celebrate2Lottie,
|
||||
height: 200,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
26.height,
|
||||
SizedBox(
|
||||
height: 50,
|
||||
child: Stack(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
"assets/images/winner_ribbon.svg",
|
||||
height: 50,
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: "WINNER".toText32(color: MyColors.white, isBold: true).paddingOnly(top: 07),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
12.height,
|
||||
"Muhammad Shrouff".toText22(color: MyColors.grey3AColor),
|
||||
"837436".toText22(color: MyColors.grey57Color),
|
||||
80.height,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
LocaleKeys.sponsoredBy.tr().toText14(color: MyColors.grey77Color),
|
||||
" Extra".toText14(color: MyColors.darkTextColor, isBold: true),
|
||||
],
|
||||
),
|
||||
5.height,
|
||||
Image.asset(
|
||||
"assets/images/logos/main_mohemm_logo.png",
|
||||
height: 40,
|
||||
fit: BoxFit.fill,
|
||||
width: 150,
|
||||
)
|
||||
],
|
||||
),
|
||||
).paddingOnly(left: 21, right: 21),
|
||||
10.height,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue