<commit_before>//import 'dart:html';

import 'package:campus_mobile_experimental/ui/theme/app_theme.dart';
import 'package:campus_mobile_experimental/core/models/availability_model.dart';
import 'package:flutter/material.dart';
//import 'package:percent_indicator/percent_indicator.dart';

class AvailabilityDisplay extends StatelessWidget {
  const AvailabilityDisplay({
    Key key,
    @required this.model,
  }) : super(key: key);

  final AvailabilityModel model;

  @override
  Widget build(BuildContext context) {
    return buildAvailabilityBars(context);
  }

  Widget buildLocationTitle() {
    return ListTile(
        title: Text(model.locationName),
        subtitle: model.isOpen ?
        Text("Open",
          style: TextStyle(
              color: Colors.black),) :
        Text("Closed",
          style: TextStyle(
              color: Colors.black),)
    );
  }

  Widget buildAvailabilityBars(BuildContext context) {
    List<Widget> locations = List<Widget>();

    if (model.subLocations.isNotEmpty) {
      for (AvailabilityModel subLocation in model.subLocations) {
        num percentage = 1 - ((subLocation.busyness) / 100).toDouble();
        locations.add(
          ListTile(
              title: Text(subLocation.locationName),
              //subtitle: Text(percentage.toString() * 100 + "%"),
              subtitle: LinearProgressIndicator(
                value: percentage,

              // backgroundColor: setIndicatorColor(percent),
                backgroundColor: Colors.grey,
                valueColor: AlwaysStoppedAnimation<Color>(setIndicatorColor(percentage)),
              )
          ),
        );
      }
    } else {
      locations.add(ListTile(
        title: Text(model.locationName),
        subtitle: LinearProgressIndicator(value: 1 - model.busyness.toDouble()),
      ));
    }
    locations =
        ListTile.divideTiles(tiles: locations, context: context).toList();
    locations.insert(
        0,
        ListTile(
          title: Row(
            children: [
              Expanded(child: buildLocationTitle()),
            ],
          ),
        ));

    return ListView(children: locations);
  }

  setIndicatorColor(num percentage) {
    if(percentage >= .75)
      return Colors.green;
    else if (percentage >= .25)
      return Colors.yellow;
    else
      return Colors.red;

  }




}<commit_msg>Not-Tested: Open-close indicator with Text<commit_after>//import 'dart:html';

import 'package:campus_mobile_experimental/ui/theme/app_theme.dart';
import 'package:campus_mobile_experimental/core/models/availability_model.dart';
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
//import 'package:percent_indicator/percent_indicator.dart';

class AvailabilityDisplay extends StatelessWidget {
  const AvailabilityDisplay({
    Key key,
    @required this.model,
  }) : super(key: key);

  final AvailabilityModel model;

  @override
  Widget build(BuildContext context) {
    return buildAvailabilityBars(context);
  }

  Widget buildLocationTitle() {
    return ListTile(
        title: Text(model.locationName),
        subtitle: Row(
          children: <Widget>[
            Container(
              decoration: BoxDecoration(
                color: model.isOpen ? Colors.green : Colors.red,
                shape: BoxShape.circle,
              ),
            ),
            Text(
              model.isOpen ? "Open" : "Closed",
            )
          ],
        ));
  }

  Widget buildAvailabilityBars(BuildContext context) {
    List<Widget> locations = List<Widget>();

    if (model.subLocations.isNotEmpty) {
      for (AvailabilityModel subLocation in model.subLocations) {
        num percentage = 1 - ((subLocation.busyness) / 100).toDouble();
        locations.add(
          ListTile(
              title: Text(subLocation.locationName),
              //subtitle: Text(percentage.toString() * 100 + "%"),
              subtitle: LinearProgressIndicator(
                value: percentage,

                // backgroundColor: setIndicatorColor(percent),
                backgroundColor: Colors.grey,
                valueColor: AlwaysStoppedAnimation<Color>(
                    setIndicatorColor(percentage)),
              )),
        );
      }
    } else {
      locations.add(ListTile(
        title: Text(model.locationName),
        subtitle: LinearProgressIndicator(
          value: 1 - model.busyness.toDouble(), 
          valueColor: setIndicatorColor(1 - model.busyness.toDouble())
        ),
      ));
    }
    locations =
        ListTile.divideTiles(tiles: locations, context: context).toList();
    locations.insert(
        0,
        ListTile(
          title: Row(
            children: [
              Expanded(child: buildLocationTitle()),
            ],
          ),
        ));

    return ListView(children: locations);
  }

  setIndicatorColor(num percentage) {
    if (percentage >= .75)
      return Colors.green;
    else if (percentage >= .25)
      return Colors.yellow;
    else
      return Colors.red;
  }
}
{'fraction_non_alphanumeric': 0.10957278481012658, 'fraction_numerical': 0.005340189873417721, 'mean_word_length': 2.254182754182754, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '130227', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1378, 'n_words': 263}