import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

/*
 *@author: Mohammad Aljammal
 *@Date:27/4/2020
 *@param: Widget
 *@return:
 *@desc: Card With Bg Widget
 */

class CardWithBgWidget extends StatelessWidget {
  final Widget child;

  CardWithBgWidget({required this.child});

  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectProvider = Provider.of(context);
    return Container(
      margin: EdgeInsets.symmetric(vertical: 5.0),
      width: double.infinity,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(
          Radius.circular(10.0),
        ),
        border: Border.all(color: Colors.grey, width: 1.0),
      ),
      child: Material(
        borderRadius: BorderRadius.all(Radius.circular(5.0)),
        child: Stack(
          children: [
            if (projectProvider.isArabic)
              Positioned(
                child: Container(
                  width: 10,
                  color: Colors.red[800],
                ),
                bottom: 0,
                top: 0,
                right: 0,
              )
            else
              Positioned(
                child: Container(
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(9.0),
                      bottomLeft: Radius.circular(9.0),
                    ),color: Colors.blueAccent,

                  ),
                  width: 15,

                ),
                bottom: 0,
                top: 0,
                left: 0,
              ),
            Container(
                padding: EdgeInsets.all(15.0),
                margin: EdgeInsets.only(left: 10),
                child: child)
          ],
        ),
      ),
    );
  }
}
