33 lines
1003 B
Dart
33 lines
1003 B
Dart
import 'package:birzha/components/productBuilder.dart';
|
|
import 'package:birzha/models/chatroom/chatroom.dart';
|
|
import 'package:birzha/models/products/post.dart';
|
|
import 'package:birzha/models/products/product.dart';
|
|
import 'package:birzha/models/transactions/transaction.dart';
|
|
import 'package:birzha/screens/personalCabinet/messages/messages.dart';
|
|
import 'package:birzha/screens/personalCabinet/topUp/topUpHistory.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class PostBuilderFactory extends StatelessWidget {
|
|
const PostBuilderFactory({ Key? key, required this.post }) : super(key: key);
|
|
|
|
final Post post;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
if(post is Product)
|
|
return ProductBuilder(product: post as Product);
|
|
|
|
else if(post is Transaction)
|
|
return TopUpHistoryCard(
|
|
transaction: post as Transaction,
|
|
);
|
|
|
|
else if(post is Chatroom)
|
|
return MessagesCard(
|
|
chatroom: post as Chatroom,
|
|
);
|
|
|
|
return Container();
|
|
}
|
|
} |