import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/labs/lab_result_history.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';

import 'lab_result_history_details_wideget.dart';
import 'line_chart_curved_lab_history.dart';

class LabResultHistoryChartAndDetails extends StatelessWidget {
  LabResultHistoryChartAndDetails({
    Key? key,
    required this.labResultHistory,
    required this.name,
  }) : super(key: key);

  final List<LabResultHistory> labResultHistory;
  final String name;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(10.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Container(
            margin: EdgeInsets.symmetric(horizontal: 8),
            decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
            child: LineChartCurvedLabHistory(
              title: name,
              labResultHistory: labResultHistory,
            ),
          ),
          Container(
            margin: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
            padding: EdgeInsets.only(top: 16, right: 18.0, left: 16.0),
            decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                AppText(
                  TranslationBase.of(context).graphDetails,
                  fontSize: SizeConfig.textMultiplier! * 2.1,
                  fontWeight: FontWeight.bold,
                ),
                SizedBox(
                  height: 8,
                ),
                LabResultHistoryDetailsWidget(
                  labResultHistory: labResultHistory.reversed.toList(),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
