|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
import 'package:test_sa/views/app_style/colors.dart';
|
|
|
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/image_loader.dart';
|
|
|
|
|
class ImageItem extends StatelessWidget {
|
|
|
|
|
final String url;
|
|
|
|
|
final bool isVideo;
|
|
|
|
|
final VoidCallback onPressed;
|
|
|
|
|
|
|
|
|
|
const ImageItem({
|
|
|
|
|
Key key,
|
|
|
|
|
this.url,
|
|
|
|
|
this.isVideo = false,
|
|
|
|
|
this.onPressed
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
width: 80 * AppStyle.getScaleFactor(context),
|
|
|
|
|
height: 40 * AppStyle.getScaleFactor(context),
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 4 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Theme.of(context).dividerColor,
|
|
|
|
|
width: 2 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
borderRadius: BorderRadius.circular(8 * AppStyle.getScaleFactor(context)),
|
|
|
|
|
),
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.circular(6 * AppStyle.getScaleFactor(context)),
|
|
|
|
|
child: Stack(
|
|
|
|
|
fit: StackFit.expand,
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
ImageLoader(url: url,),
|
|
|
|
|
MaterialButton(
|
|
|
|
|
onPressed: onPressed,
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
child: Visibility(
|
|
|
|
|
visible: isVideo,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.black45,
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
child: FaIcon(
|
|
|
|
|
FontAwesomeIcons.playCircle,
|
|
|
|
|
size: 32 * AppStyle.getScaleFactor(context),
|
|
|
|
|
color: AColors.orange,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|