import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:provider/provider.dart';

import '../shared/rounded_container_widget.dart';
import '../shared/app_texts_widget.dart';
import 'package:flutter/material.dart';

class DashboardItemTexts extends StatefulWidget {
  final String label;
  final String value;
  final Color backgroundColor;
  final bool showBorder;
  final Color borderColor;

// OWNER : Ibrahim albitar
// DATE : 05-04-2020
// DESCRIPTION : Custom widget for dashboard items has texts widgets

  DashboardItemTexts(this.label, this.value,
      {this.backgroundColor = Colors.white,
      this.showBorder = false,
      this.borderColor = Colors.white});

  @override
  _DashboardItemTextsState createState() => _DashboardItemTextsState();
}

class _DashboardItemTextsState extends State<DashboardItemTexts> {
  ProjectViewModel projectsProvider;
  @override
  Widget build(BuildContext context) {
    projectsProvider = Provider.of(context);
    return new RoundedContainer(
      child: Stack(
        children: <Widget>[
          Align(
              alignment: projectsProvider.isArabic
                  ? FractionalOffset.topRight
                  : FractionalOffset.topLeft,
              child: Container(
                margin: EdgeInsets.all(5),
                child: AppText(
                  widget.label,
                  fontSize: 12,
                ),
              )),
          Align(
              alignment: projectsProvider.isArabic
                  ? FractionalOffset.bottomLeft
                  : FractionalOffset.bottomRight,
              child: Container(
                margin: EdgeInsets.all(10),
                child: AppText(
                  widget.value,
                  fontWeight: FontWeight.bold,
                ),
              )),
        ],
      ),
      backgroundColor: widget.backgroundColor,
      showBorder: widget.showBorder,
      borderColor: widget.borderColor,
      margin: 4,
    );
  }
}
