import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class StatusFeedbackPage extends StatefulWidget {
  @override
  _StatusFeedbackPageState createState() => _StatusFeedbackPageState();
}

class _StatusFeedbackPageState extends State<StatusFeedbackPage> {

  @override
  Widget build(BuildContext context) {
    return BaseView<FeedbackViewModel>(
      onModelReady: (model) => model.getCOC(),
      builder: (_, model, widget) => AppScaffold(
        baseViewModel: model,
        body: Container(
          margin: EdgeInsets.only(top: 8.0,left: 8.0,right: 8.0 ),
          padding: EdgeInsets.all(15.0),
          child: ListView.builder(
              itemCount: model.cOCItemList.length,
              itemBuilder: (context, index) => Container(
                decoration: BoxDecoration(
                  shape: BoxShape.rectangle,
                    border: Border.all(color: Colors.white, width: 0.5),
                  borderRadius: BorderRadius.all(Radius.circular(5)),
                  color: Colors.white,
                ),
                margin: EdgeInsets.all(4),
                child: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      SizedBox(height: 8,),
                      Row(
                        mainAxisAlignment:
                        MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          Expanded(
                            child: Column(
                              crossAxisAlignment:
                              CrossAxisAlignment.start,
                              children: <Widget>[
                                Texts('${model.cOCItemList[index].cOCTitle}'),
                                Texts(
                                  'Number :${model.cOCItemList[index].itemID}',
                                  variant: 'overline',
                                ),
                              ],
                            ),
                          ),
                          Expanded(
                            child: Column(
                              crossAxisAlignment:
                              CrossAxisAlignment.start,
                              children: <Widget>[
                                Texts('${model.cOCItemList[index].status}'),
                                Texts(
                                  '${model.cOCItemList[index].date}',
                                  variant: 'overline',
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                      Texts('${model.cOCItemList[index].formType}'),
                      Divider(height: 4.5,color: Colors.grey[500],)
                    ],
                  ),
                ),
              )),
        ),
      ),
    );
  }
}
