import 'package:hmg_patient_app/core/enum/viewstate.dart';
import 'package:hmg_patient_app/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/pages/base/base_view.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:hmg_patient_app/uitl/utils_new.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:hmg_patient_app/widgets/charts/custom_line_chart.dart';

class MonthPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectViewModel = Provider.of(context);
    return BaseView<H2OViewModel>(
      onModelReady: (model) => model.getUserProgressForMonthData(),
      builder: (_, model, widget) => AppScaffold(
        isShowAppBar: false,
        appBarTitle: TranslationBase.of(context).h2o,
        baseViewModel: model,
        body: SingleChildScrollView(
          padding: EdgeInsets.all(21),
          physics: BouncingScrollPhysics(),
          child: (model.userProgressForMonthDataSeries ?? []).isEmpty
              ? getNoDataWidget(context)
              : Container(
                  padding: EdgeInsets.fromLTRB(16, 14, 16, 14),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(
                      Radius.circular(10.0),
                    ),
                    boxShadow: [
                      BoxShadow(
                        color: Color(0xff000000).withOpacity(.05),
                        blurRadius: 27,
                        offset: Offset(0, -3),
                      ),
                    ],
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisSize: MainAxisSize.min,
                    children: [
                      Text(
                        TranslationBase.of(context).waterConsumedInMonth,
                        style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64),
                      ),
                      SizedBox(height: 24),
                      CustomLineChart(model.userProgressForMonthDataSeries!, projectViewModel.isArabic),
                    ],
                  ),
                ),
        ),
      ),
    );
  }
}
