app/lib/view/widgets/list_contents_box.dart

60 lines
2 KiB
Dart
Raw Normal View History

import 'package:page_transition/page_transition.dart';
2021-08-15 16:22:20 +02:00
import 'package:flutter/material.dart';
import 'package:easy_learn/view/screens/content.dart';
2021-08-15 16:22:20 +02:00
class ListContentsBox extends StatelessWidget {
2021-08-24 15:00:46 +02:00
const ListContentsBox({Key? key, required this.imagePath, required this.title, required this.locked}) : super(key: key);
2021-08-15 16:22:20 +02:00
final String imagePath;
final String title;
2021-08-24 15:00:46 +02:00
final bool locked;
2021-08-15 16:22:20 +02:00
@override
Widget build(BuildContext context) {
return InkWell(
onTap: (){
2021-08-24 15:00:46 +02:00
if (!locked) {
Navigator.push(context, PageTransition(type: PageTransitionType.rightToLeft, child: const Content(category: 'chapter 1')));
}
},
2021-08-24 15:00:46 +02:00
child: Banner(
location: BannerLocation.topEnd,
message: locked == false ? "Unlocked" : "Locked",
color: locked == false ? Colors.green.withOpacity(0.6) : Colors.red.withOpacity(0.6),
textStyle: const TextStyle(fontWeight: FontWeight.w700, fontSize: 12.0, letterSpacing: 1.0),
textDirection: TextDirection.ltr,
child: Container(
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.3),
borderRadius: const BorderRadius.all(Radius.circular(25.0))
),
child: Stack(
children: [
Container(
margin: const EdgeInsets.all(25.0),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(imagePath)
)
),
width: 300,
height: 300,
2021-08-15 16:22:20 +02:00
),
2021-08-24 15:00:46 +02:00
SizedBox.expand(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(title, style: const TextStyle(fontSize: 20, color: Colors.white),)
],
),
)
],
)
),
2021-08-15 16:22:20 +02:00
),
);
}
}