repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/SimplicityWeather/lib/generated
mirrored_repositories/SimplicityWeather/lib/generated/json/district_model_entity_helper.dart
import 'package:flutter_dynamic_weather/model/district_model_entity.dart'; districtModelEntityFromJson(DistrictModelEntity data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['info'] != null) { data.info = json['info']?.toString(); } if (json['count'] != null) { data.count = json['count']?.toString(); } if (json['districts'] != null) { data.districts = new List<DistrictModelDistrict>(); (json['districts'] as List).forEach((v) { data.districts.add(new DistrictModelDistrict().fromJson(v)); }); } return data; } Map<String, dynamic> districtModelEntityToJson(DistrictModelEntity entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; data['info'] = entity.info; data['count'] = entity.count; if (entity.districts != null) { data['districts'] = entity.districts.map((v) => v.toJson()).toList(); } return data; } districtModelDistrictFromJson(DistrictModelDistrict data, Map<String, dynamic> json) { if (json['adcode'] != null) { data.adcode = json['adcode']?.toString(); } if (json['name'] != null) { data.name = json['name']?.toString(); } if (json['center'] != null) { data.center = json['center']?.toString(); } if (json['level'] != null) { data.level = json['level']?.toString(); } if (json['districts'] != null) { data.districts = new List<DistrictModelDistrictsDistrict>(); (json['districts'] as List).forEach((v) { data.districts.add(new DistrictModelDistrictsDistrict().fromJson(v)); }); } return data; } Map<String, dynamic> districtModelDistrictToJson(DistrictModelDistrict entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['adcode'] = entity.adcode; data['name'] = entity.name; data['center'] = entity.center; data['level'] = entity.level; if (entity.districts != null) { data['districts'] = entity.districts.map((v) => v.toJson()).toList(); } return data; } districtModelDistrictsDistrictFromJson(DistrictModelDistrictsDistrict data, Map<String, dynamic> json) { if (json['adcode'] != null) { data.adcode = json['adcode']?.toString(); } if (json['name'] != null) { data.name = json['name']?.toString(); } if (json['center'] != null) { data.center = json['center']?.toString(); } if (json['level'] != null) { data.level = json['level']?.toString(); } if (json['districts'] != null) { data.districts = new List<dynamic>(); data.districts.addAll(json['districts']); } return data; } Map<String, dynamic> districtModelDistrictsDistrictToJson(DistrictModelDistrictsDistrict entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['adcode'] = entity.adcode; data['name'] = entity.name; data['center'] = entity.center; data['level'] = entity.level; if (entity.districts != null) { data['districts'] = []; } return data; }
0
mirrored_repositories/SimplicityWeather/lib/generated
mirrored_repositories/SimplicityWeather/lib/generated/json/weather_model_entity_helper.dart
import 'package:flutter_dynamic_weather/model/weather_model_entity.dart'; weatherModelEntityFromJson(WeatherModelEntity data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['api_version'] != null) { data.apiVersion = json['api_version']?.toString(); } if (json['api_status'] != null) { data.apiStatus = json['api_status']?.toString(); } if (json['lang'] != null) { data.lang = json['lang']?.toString(); } if (json['unit'] != null) { data.unit = json['unit']?.toString(); } if (json['tzshift'] != null) { data.tzshift = json['tzshift']?.toInt(); } if (json['timezone'] != null) { data.timezone = json['timezone']?.toString(); } if (json['server_time'] != null) { data.serverTime = json['server_time']?.toInt(); } if (json['location'] != null) { data.location = json['location']?.map((v) => v?.toDouble())?.toList()?.cast<double>(); } if (json['result'] != null) { data.result = new WeatherModelResult().fromJson(json['result']); } return data; } Map<String, dynamic> weatherModelEntityToJson(WeatherModelEntity entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; data['api_version'] = entity.apiVersion; data['api_status'] = entity.apiStatus; data['lang'] = entity.lang; data['unit'] = entity.unit; data['tzshift'] = entity.tzshift; data['timezone'] = entity.timezone; data['server_time'] = entity.serverTime; data['location'] = entity.location; if (entity.result != null) { data['result'] = entity.result.toJson(); } return data; } weatherModelResultFromJson(WeatherModelResult data, Map<String, dynamic> json) { if (json['realtime'] != null) { data.realtime = new WeatherModelResultRealtime().fromJson(json['realtime']); } if (json['minutely'] != null) { data.minutely = new WeatherModelResultMinutely().fromJson(json['minutely']); } if (json['hourly'] != null) { data.hourly = new WeatherModelResultHourly().fromJson(json['hourly']); } if (json['daily'] != null) { data.daily = new WeatherModelResultDaily().fromJson(json['daily']); } if (json['primary'] != null) { data.primary = json['primary']?.toInt(); } if (json['forecast_keypoint'] != null) { data.forecastKeypoint = json['forecast_keypoint']?.toString(); } return data; } Map<String, dynamic> weatherModelResultToJson(WeatherModelResult entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); if (entity.realtime != null) { data['realtime'] = entity.realtime.toJson(); } if (entity.minutely != null) { data['minutely'] = entity.minutely.toJson(); } if (entity.hourly != null) { data['hourly'] = entity.hourly.toJson(); } if (entity.daily != null) { data['daily'] = entity.daily.toJson(); } data['primary'] = entity.primary; data['forecast_keypoint'] = entity.forecastKeypoint; return data; } weatherModelResultRealtimeFromJson(WeatherModelResultRealtime data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['temperature'] != null) { data.temperature = json['temperature']?.toInt(); } if (json['humidity'] != null) { data.humidity = json['humidity']?.toDouble(); } if (json['cloudrate'] != null) { data.cloudrate = json['cloudrate']?.toDouble(); } if (json['skycon'] != null) { data.skycon = json['skycon']?.toString(); } if (json['visibility'] != null) { data.visibility = json['visibility']?.toDouble(); } if (json['dswrf'] != null) { data.dswrf = json['dswrf']?.toDouble(); } if (json['wind'] != null) { data.wind = new WeatherModelResultRealtimeWind().fromJson(json['wind']); } if (json['pressure'] != null) { data.pressure = json['pressure']?.toDouble(); } if (json['apparent_temperature'] != null) { data.apparentTemperature = json['apparent_temperature']?.toDouble(); } if (json['precipitation'] != null) { data.precipitation = new WeatherModelResultRealtimePrecipitation().fromJson(json['precipitation']); } if (json['air_quality'] != null) { data.airQuality = new WeatherModelResultRealtimeAirQuality().fromJson(json['air_quality']); } if (json['life_index'] != null) { data.lifeIndex = new WeatherModelResultRealtimeLifeIndex().fromJson(json['life_index']); } return data; } Map<String, dynamic> weatherModelResultRealtimeToJson(WeatherModelResultRealtime entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; data['temperature'] = entity.temperature; data['humidity'] = entity.humidity; data['cloudrate'] = entity.cloudrate; data['skycon'] = entity.skycon; data['visibility'] = entity.visibility; data['dswrf'] = entity.dswrf; if (entity.wind != null) { data['wind'] = entity.wind.toJson(); } data['pressure'] = entity.pressure; data['apparent_temperature'] = entity.apparentTemperature; if (entity.precipitation != null) { data['precipitation'] = entity.precipitation.toJson(); } if (entity.airQuality != null) { data['air_quality'] = entity.airQuality.toJson(); } if (entity.lifeIndex != null) { data['life_index'] = entity.lifeIndex.toJson(); } return data; } weatherModelResultRealtimeWindFromJson(WeatherModelResultRealtimeWind data, Map<String, dynamic> json) { if (json['speed'] != null) { data.speed = json['speed']?.toDouble(); } if (json['direction'] != null) { data.direction = json['direction']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultRealtimeWindToJson(WeatherModelResultRealtimeWind entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['speed'] = entity.speed; data['direction'] = entity.direction; return data; } weatherModelResultRealtimePrecipitationFromJson(WeatherModelResultRealtimePrecipitation data, Map<String, dynamic> json) { if (json['local'] != null) { data.local = new WeatherModelResultRealtimePrecipitationLocal().fromJson(json['local']); } if (json['nearest'] != null) { data.nearest = new WeatherModelResultRealtimePrecipitationNearest().fromJson(json['nearest']); } return data; } Map<String, dynamic> weatherModelResultRealtimePrecipitationToJson(WeatherModelResultRealtimePrecipitation entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); if (entity.local != null) { data['local'] = entity.local.toJson(); } if (entity.nearest != null) { data['nearest'] = entity.nearest.toJson(); } return data; } weatherModelResultRealtimePrecipitationLocalFromJson(WeatherModelResultRealtimePrecipitationLocal data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['datasource'] != null) { data.datasource = json['datasource']?.toString(); } if (json['intensity'] != null) { data.intensity = json['intensity']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultRealtimePrecipitationLocalToJson(WeatherModelResultRealtimePrecipitationLocal entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; data['datasource'] = entity.datasource; data['intensity'] = entity.intensity; return data; } weatherModelResultRealtimePrecipitationNearestFromJson(WeatherModelResultRealtimePrecipitationNearest data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['distance'] != null) { data.distance = json['distance']?.toInt(); } if (json['intensity'] != null) { data.intensity = json['intensity']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultRealtimePrecipitationNearestToJson(WeatherModelResultRealtimePrecipitationNearest entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; data['distance'] = entity.distance; data['intensity'] = entity.intensity; return data; } weatherModelResultRealtimeAirQualityFromJson(WeatherModelResultRealtimeAirQuality data, Map<String, dynamic> json) { if (json['pm25'] != null) { data.pm25 = json['pm25']?.toInt(); } if (json['pm10'] != null) { data.pm10 = json['pm10']?.toInt(); } if (json['o3'] != null) { data.o3 = json['o3']?.toInt(); } if (json['so2'] != null) { data.so2 = json['so2']?.toInt(); } if (json['no2'] != null) { data.no2 = json['no2']?.toInt(); } if (json['co'] != null) { data.co = json['co']?.toInt(); } if (json['aqi'] != null) { data.aqi = new WeatherModelResultRealtimeAirQualityAqi().fromJson(json['aqi']); } if (json['description'] != null) { data.description = new WeatherModelResultRealtimeAirQualityDescription().fromJson(json['description']); } return data; } Map<String, dynamic> weatherModelResultRealtimeAirQualityToJson(WeatherModelResultRealtimeAirQuality entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['pm25'] = entity.pm25; data['pm10'] = entity.pm10; data['o3'] = entity.o3; data['so2'] = entity.so2; data['no2'] = entity.no2; data['co'] = entity.co; if (entity.aqi != null) { data['aqi'] = entity.aqi.toJson(); } if (entity.description != null) { data['description'] = entity.description.toJson(); } return data; } weatherModelResultRealtimeAirQualityAqiFromJson(WeatherModelResultRealtimeAirQualityAqi data, Map<String, dynamic> json) { if (json['chn'] != null) { data.chn = json['chn']?.toInt(); } if (json['usa'] != null) { data.usa = json['usa']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultRealtimeAirQualityAqiToJson(WeatherModelResultRealtimeAirQualityAqi entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['chn'] = entity.chn; data['usa'] = entity.usa; return data; } weatherModelResultRealtimeAirQualityDescriptionFromJson(WeatherModelResultRealtimeAirQualityDescription data, Map<String, dynamic> json) { if (json['usa'] != null) { data.usa = json['usa']?.toString(); } if (json['chn'] != null) { data.chn = json['chn']?.toString(); } return data; } Map<String, dynamic> weatherModelResultRealtimeAirQualityDescriptionToJson(WeatherModelResultRealtimeAirQualityDescription entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['usa'] = entity.usa; data['chn'] = entity.chn; return data; } weatherModelResultRealtimeLifeIndexFromJson(WeatherModelResultRealtimeLifeIndex data, Map<String, dynamic> json) { if (json['ultraviolet'] != null) { data.ultraviolet = new WeatherModelResultRealtimeLifeIndexUltraviolet().fromJson(json['ultraviolet']); } if (json['comfort'] != null) { data.comfort = new WeatherModelResultRealtimeLifeIndexComfort().fromJson(json['comfort']); } return data; } Map<String, dynamic> weatherModelResultRealtimeLifeIndexToJson(WeatherModelResultRealtimeLifeIndex entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); if (entity.ultraviolet != null) { data['ultraviolet'] = entity.ultraviolet.toJson(); } if (entity.comfort != null) { data['comfort'] = entity.comfort.toJson(); } return data; } weatherModelResultRealtimeLifeIndexUltravioletFromJson(WeatherModelResultRealtimeLifeIndexUltraviolet data, Map<String, dynamic> json) { if (json['index'] != null) { data.index = json['index']?.toInt(); } if (json['desc'] != null) { data.desc = json['desc']?.toString(); } return data; } Map<String, dynamic> weatherModelResultRealtimeLifeIndexUltravioletToJson(WeatherModelResultRealtimeLifeIndexUltraviolet entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['index'] = entity.index; data['desc'] = entity.desc; return data; } weatherModelResultRealtimeLifeIndexComfortFromJson(WeatherModelResultRealtimeLifeIndexComfort data, Map<String, dynamic> json) { if (json['index'] != null) { data.index = json['index']?.toInt(); } if (json['desc'] != null) { data.desc = json['desc']?.toString(); } return data; } Map<String, dynamic> weatherModelResultRealtimeLifeIndexComfortToJson(WeatherModelResultRealtimeLifeIndexComfort entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['index'] = entity.index; data['desc'] = entity.desc; return data; } weatherModelResultMinutelyFromJson(WeatherModelResultMinutely data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['datasource'] != null) { data.datasource = json['datasource']?.toString(); } if (json['precipitation_2h'] != null) { data.precipitation2h = json['precipitation_2h']?.map((v) => v?.toInt())?.toList()?.cast<int>(); } if (json['precipitation'] != null) { data.precipitation = json['precipitation']?.map((v) => v?.toInt())?.toList()?.cast<int>(); } if (json['probability'] != null) { data.probability = json['probability']?.map((v) => v?.toInt())?.toList()?.cast<int>(); } if (json['description'] != null) { data.description = json['description']?.toString(); } return data; } Map<String, dynamic> weatherModelResultMinutelyToJson(WeatherModelResultMinutely entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; data['datasource'] = entity.datasource; data['precipitation_2h'] = entity.precipitation2h; data['precipitation'] = entity.precipitation; data['probability'] = entity.probability; data['description'] = entity.description; return data; } weatherModelResultHourlyFromJson(WeatherModelResultHourly data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['description'] != null) { data.description = json['description']?.toString(); } if (json['precipitation'] != null) { data.precipitation = new List<WeatherModelResultHourlyPrecipitation>(); (json['precipitation'] as List).forEach((v) { data.precipitation.add(new WeatherModelResultHourlyPrecipitation().fromJson(v)); }); } if (json['temperature'] != null) { data.temperature = new List<WeatherModelResultHourlyTemperature>(); (json['temperature'] as List).forEach((v) { data.temperature.add(new WeatherModelResultHourlyTemperature().fromJson(v)); }); } if (json['wind'] != null) { data.wind = new List<WeatherModelResultHourlyWind>(); (json['wind'] as List).forEach((v) { data.wind.add(new WeatherModelResultHourlyWind().fromJson(v)); }); } if (json['humidity'] != null) { data.humidity = new List<WeatherModelResultHourlyHumidity>(); (json['humidity'] as List).forEach((v) { data.humidity.add(new WeatherModelResultHourlyHumidity().fromJson(v)); }); } if (json['cloudrate'] != null) { data.cloudrate = new List<WeatherModelResultHourlyCloudrate>(); (json['cloudrate'] as List).forEach((v) { data.cloudrate.add(new WeatherModelResultHourlyCloudrate().fromJson(v)); }); } if (json['skycon'] != null) { data.skycon = new List<WeatherModelResultHourlySkycon>(); (json['skycon'] as List).forEach((v) { data.skycon.add(new WeatherModelResultHourlySkycon().fromJson(v)); }); } if (json['pressure'] != null) { data.pressure = new List<WeatherModelResultHourlyPressure>(); (json['pressure'] as List).forEach((v) { data.pressure.add(new WeatherModelResultHourlyPressure().fromJson(v)); }); } if (json['visibility'] != null) { data.visibility = new List<WeatherModelResultHourlyVisibility>(); (json['visibility'] as List).forEach((v) { data.visibility.add(new WeatherModelResultHourlyVisibility().fromJson(v)); }); } if (json['dswrf'] != null) { data.dswrf = new List<WeatherModelResultHourlyDswrf>(); (json['dswrf'] as List).forEach((v) { data.dswrf.add(new WeatherModelResultHourlyDswrf().fromJson(v)); }); } if (json['air_quality'] != null) { data.airQuality = new WeatherModelResultHourlyAirQuality().fromJson(json['air_quality']); } return data; } Map<String, dynamic> weatherModelResultHourlyToJson(WeatherModelResultHourly entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; data['description'] = entity.description; if (entity.precipitation != null) { data['precipitation'] = entity.precipitation.map((v) => v.toJson()).toList(); } if (entity.temperature != null) { data['temperature'] = entity.temperature.map((v) => v.toJson()).toList(); } if (entity.wind != null) { data['wind'] = entity.wind.map((v) => v.toJson()).toList(); } if (entity.humidity != null) { data['humidity'] = entity.humidity.map((v) => v.toJson()).toList(); } if (entity.cloudrate != null) { data['cloudrate'] = entity.cloudrate.map((v) => v.toJson()).toList(); } if (entity.skycon != null) { data['skycon'] = entity.skycon.map((v) => v.toJson()).toList(); } if (entity.pressure != null) { data['pressure'] = entity.pressure.map((v) => v.toJson()).toList(); } if (entity.visibility != null) { data['visibility'] = entity.visibility.map((v) => v.toJson()).toList(); } if (entity.dswrf != null) { data['dswrf'] = entity.dswrf.map((v) => v.toJson()).toList(); } if (entity.airQuality != null) { data['air_quality'] = entity.airQuality.toJson(); } return data; } weatherModelResultHourlyPrecipitationFromJson(WeatherModelResultHourlyPrecipitation data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultHourlyPrecipitationToJson(WeatherModelResultHourlyPrecipitation entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlyTemperatureFromJson(WeatherModelResultHourlyTemperature data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultHourlyTemperatureToJson(WeatherModelResultHourlyTemperature entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlyWindFromJson(WeatherModelResultHourlyWind data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['speed'] != null) { data.speed = json['speed']?.toDouble(); } if (json['direction'] != null) { data.direction = json['direction']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultHourlyWindToJson(WeatherModelResultHourlyWind entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['speed'] = entity.speed; data['direction'] = entity.direction; return data; } weatherModelResultHourlyHumidityFromJson(WeatherModelResultHourlyHumidity data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultHourlyHumidityToJson(WeatherModelResultHourlyHumidity entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlyCloudrateFromJson(WeatherModelResultHourlyCloudrate data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultHourlyCloudrateToJson(WeatherModelResultHourlyCloudrate entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlySkyconFromJson(WeatherModelResultHourlySkycon data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toString(); } return data; } Map<String, dynamic> weatherModelResultHourlySkyconToJson(WeatherModelResultHourlySkycon entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlyPressureFromJson(WeatherModelResultHourlyPressure data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultHourlyPressureToJson(WeatherModelResultHourlyPressure entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlyVisibilityFromJson(WeatherModelResultHourlyVisibility data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultHourlyVisibilityToJson(WeatherModelResultHourlyVisibility entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlyDswrfFromJson(WeatherModelResultHourlyDswrf data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultHourlyDswrfToJson(WeatherModelResultHourlyDswrf entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultHourlyAirQualityFromJson(WeatherModelResultHourlyAirQuality data, Map<String, dynamic> json) { if (json['aqi'] != null) { data.aqi = new List<WeatherModelResultHourlyAirQualityAqi>(); (json['aqi'] as List).forEach((v) { data.aqi.add(new WeatherModelResultHourlyAirQualityAqi().fromJson(v)); }); } if (json['pm25'] != null) { data.pm25 = new List<WeatherModelResultHourlyAirQualityPm25>(); (json['pm25'] as List).forEach((v) { data.pm25.add(new WeatherModelResultHourlyAirQualityPm25().fromJson(v)); }); } return data; } Map<String, dynamic> weatherModelResultHourlyAirQualityToJson(WeatherModelResultHourlyAirQuality entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); if (entity.aqi != null) { data['aqi'] = entity.aqi.map((v) => v.toJson()).toList(); } if (entity.pm25 != null) { data['pm25'] = entity.pm25.map((v) => v.toJson()).toList(); } return data; } weatherModelResultHourlyAirQualityAqiFromJson(WeatherModelResultHourlyAirQualityAqi data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = new WeatherModelResultHourlyAirQualityAqiValue().fromJson(json['value']); } return data; } Map<String, dynamic> weatherModelResultHourlyAirQualityAqiToJson(WeatherModelResultHourlyAirQualityAqi entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; if (entity.value != null) { data['value'] = entity.value.toJson(); } return data; } weatherModelResultHourlyAirQualityAqiValueFromJson(WeatherModelResultHourlyAirQualityAqiValue data, Map<String, dynamic> json) { if (json['chn'] != null) { data.chn = json['chn']?.toInt(); } if (json['usa'] != null) { data.usa = json['usa']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultHourlyAirQualityAqiValueToJson(WeatherModelResultHourlyAirQualityAqiValue entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['chn'] = entity.chn; data['usa'] = entity.usa; return data; } weatherModelResultHourlyAirQualityPm25FromJson(WeatherModelResultHourlyAirQualityPm25 data, Map<String, dynamic> json) { if (json['datetime'] != null) { data.datetime = json['datetime']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultHourlyAirQualityPm25ToJson(WeatherModelResultHourlyAirQualityPm25 entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['datetime'] = entity.datetime; data['value'] = entity.value; return data; } weatherModelResultDailyFromJson(WeatherModelResultDaily data, Map<String, dynamic> json) { if (json['status'] != null) { data.status = json['status']?.toString(); } if (json['astro'] != null) { data.astro = new List<WeatherModelResultDailyAstro>(); (json['astro'] as List).forEach((v) { data.astro.add(new WeatherModelResultDailyAstro().fromJson(v)); }); } if (json['precipitation'] != null) { data.precipitation = new List<WeatherModelResultDailyPrecipitation>(); (json['precipitation'] as List).forEach((v) { data.precipitation.add(new WeatherModelResultDailyPrecipitation().fromJson(v)); }); } if (json['temperature'] != null) { data.temperature = new List<WeatherModelResultDailyTemperature>(); (json['temperature'] as List).forEach((v) { data.temperature.add(new WeatherModelResultDailyTemperature().fromJson(v)); }); } if (json['wind'] != null) { data.wind = new List<WeatherModelResultDailyWind>(); (json['wind'] as List).forEach((v) { data.wind.add(new WeatherModelResultDailyWind().fromJson(v)); }); } if (json['humidity'] != null) { data.humidity = new List<WeatherModelResultDailyHumidity>(); (json['humidity'] as List).forEach((v) { data.humidity.add(new WeatherModelResultDailyHumidity().fromJson(v)); }); } if (json['cloudrate'] != null) { data.cloudrate = new List<WeatherModelResultDailyCloudrate>(); (json['cloudrate'] as List).forEach((v) { data.cloudrate.add(new WeatherModelResultDailyCloudrate().fromJson(v)); }); } if (json['pressure'] != null) { data.pressure = new List<WeatherModelResultDailyPressure>(); (json['pressure'] as List).forEach((v) { data.pressure.add(new WeatherModelResultDailyPressure().fromJson(v)); }); } if (json['visibility'] != null) { data.visibility = new List<WeatherModelResultDailyVisibility>(); (json['visibility'] as List).forEach((v) { data.visibility.add(new WeatherModelResultDailyVisibility().fromJson(v)); }); } if (json['dswrf'] != null) { data.dswrf = new List<WeatherModelResultDailyDswrf>(); (json['dswrf'] as List).forEach((v) { data.dswrf.add(new WeatherModelResultDailyDswrf().fromJson(v)); }); } if (json['air_quality'] != null) { data.airQuality = new WeatherModelResultDailyAirQuality().fromJson(json['air_quality']); } if (json['skycon'] != null) { data.skycon = new List<WeatherModelResultDailySkycon>(); (json['skycon'] as List).forEach((v) { data.skycon.add(new WeatherModelResultDailySkycon().fromJson(v)); }); } if (json['skycon_08h_20h'] != null) { data.skycon08h20h = new List<WeatherModelResultDailySkycon08h20h>(); (json['skycon_08h_20h'] as List).forEach((v) { data.skycon08h20h.add(new WeatherModelResultDailySkycon08h20h().fromJson(v)); }); } if (json['skycon_20h_32h'] != null) { data.skycon20h32h = new List<WeatherModelResultDailySkycon20h32h>(); (json['skycon_20h_32h'] as List).forEach((v) { data.skycon20h32h.add(new WeatherModelResultDailySkycon20h32h().fromJson(v)); }); } if (json['life_index'] != null) { data.lifeIndex = new WeatherModelResultDailyLifeIndex().fromJson(json['life_index']); } return data; } Map<String, dynamic> weatherModelResultDailyToJson(WeatherModelResultDaily entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = entity.status; if (entity.astro != null) { data['astro'] = entity.astro.map((v) => v.toJson()).toList(); } if (entity.precipitation != null) { data['precipitation'] = entity.precipitation.map((v) => v.toJson()).toList(); } if (entity.temperature != null) { data['temperature'] = entity.temperature.map((v) => v.toJson()).toList(); } if (entity.wind != null) { data['wind'] = entity.wind.map((v) => v.toJson()).toList(); } if (entity.humidity != null) { data['humidity'] = entity.humidity.map((v) => v.toJson()).toList(); } if (entity.cloudrate != null) { data['cloudrate'] = entity.cloudrate.map((v) => v.toJson()).toList(); } if (entity.pressure != null) { data['pressure'] = entity.pressure.map((v) => v.toJson()).toList(); } if (entity.visibility != null) { data['visibility'] = entity.visibility.map((v) => v.toJson()).toList(); } if (entity.dswrf != null) { data['dswrf'] = entity.dswrf.map((v) => v.toJson()).toList(); } if (entity.airQuality != null) { data['air_quality'] = entity.airQuality.toJson(); } if (entity.skycon != null) { data['skycon'] = entity.skycon.map((v) => v.toJson()).toList(); } if (entity.skycon08h20h != null) { data['skycon_08h_20h'] = entity.skycon08h20h.map((v) => v.toJson()).toList(); } if (entity.skycon20h32h != null) { data['skycon_20h_32h'] = entity.skycon20h32h.map((v) => v.toJson()).toList(); } if (entity.lifeIndex != null) { data['life_index'] = entity.lifeIndex.toJson(); } return data; } weatherModelResultDailyAstroFromJson(WeatherModelResultDailyAstro data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['sunrise'] != null) { data.sunrise = new WeatherModelResultDailyAstroSunrise().fromJson(json['sunrise']); } if (json['sunset'] != null) { data.sunset = new WeatherModelResultDailyAstroSunset().fromJson(json['sunset']); } return data; } Map<String, dynamic> weatherModelResultDailyAstroToJson(WeatherModelResultDailyAstro entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; if (entity.sunrise != null) { data['sunrise'] = entity.sunrise.toJson(); } if (entity.sunset != null) { data['sunset'] = entity.sunset.toJson(); } return data; } weatherModelResultDailyAstroSunriseFromJson(WeatherModelResultDailyAstroSunrise data, Map<String, dynamic> json) { if (json['time'] != null) { data.time = json['time']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailyAstroSunriseToJson(WeatherModelResultDailyAstroSunrise entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['time'] = entity.time; return data; } weatherModelResultDailyAstroSunsetFromJson(WeatherModelResultDailyAstroSunset data, Map<String, dynamic> json) { if (json['time'] != null) { data.time = json['time']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailyAstroSunsetToJson(WeatherModelResultDailyAstroSunset entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['time'] = entity.time; return data; } weatherModelResultDailyPrecipitationFromJson(WeatherModelResultDailyPrecipitation data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toInt(); } if (json['min'] != null) { data.min = json['min']?.toInt(); } if (json['avg'] != null) { data.avg = json['avg']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultDailyPrecipitationToJson(WeatherModelResultDailyPrecipitation entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['min'] = entity.min; data['avg'] = entity.avg; return data; } weatherModelResultDailyTemperatureFromJson(WeatherModelResultDailyTemperature data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toInt(); } if (json['min'] != null) { data.min = json['min']?.toInt(); } if (json['avg'] != null) { data.avg = json['avg']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyTemperatureToJson(WeatherModelResultDailyTemperature entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['min'] = entity.min; data['avg'] = entity.avg; return data; } weatherModelResultDailyWindFromJson(WeatherModelResultDailyWind data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = new WeatherModelResultDailyWindMax().fromJson(json['max']); } if (json['min'] != null) { data.min = new WeatherModelResultDailyWindMin().fromJson(json['min']); } if (json['avg'] != null) { data.avg = new WeatherModelResultDailyWindAvg().fromJson(json['avg']); } return data; } Map<String, dynamic> weatherModelResultDailyWindToJson(WeatherModelResultDailyWind entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; if (entity.max != null) { data['max'] = entity.max.toJson(); } if (entity.min != null) { data['min'] = entity.min.toJson(); } if (entity.avg != null) { data['avg'] = entity.avg.toJson(); } return data; } weatherModelResultDailyWindMaxFromJson(WeatherModelResultDailyWindMax data, Map<String, dynamic> json) { if (json['speed'] != null) { data.speed = json['speed']?.toDouble(); } if (json['direction'] != null) { data.direction = json['direction']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyWindMaxToJson(WeatherModelResultDailyWindMax entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['speed'] = entity.speed; data['direction'] = entity.direction; return data; } weatherModelResultDailyWindMinFromJson(WeatherModelResultDailyWindMin data, Map<String, dynamic> json) { if (json['speed'] != null) { data.speed = json['speed']?.toDouble(); } if (json['direction'] != null) { data.direction = json['direction']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyWindMinToJson(WeatherModelResultDailyWindMin entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['speed'] = entity.speed; data['direction'] = entity.direction; return data; } weatherModelResultDailyWindAvgFromJson(WeatherModelResultDailyWindAvg data, Map<String, dynamic> json) { if (json['speed'] != null) { data.speed = json['speed']?.toDouble(); } if (json['direction'] != null) { data.direction = json['direction']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyWindAvgToJson(WeatherModelResultDailyWindAvg entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['speed'] = entity.speed; data['direction'] = entity.direction; return data; } weatherModelResultDailyHumidityFromJson(WeatherModelResultDailyHumidity data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toDouble(); } if (json['min'] != null) { data.min = json['min']?.toDouble(); } if (json['avg'] != null) { data.avg = json['avg']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyHumidityToJson(WeatherModelResultDailyHumidity entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['min'] = entity.min; data['avg'] = entity.avg; return data; } weatherModelResultDailyCloudrateFromJson(WeatherModelResultDailyCloudrate data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toDouble(); } if (json['min'] != null) { data.min = json['min']?.toDouble(); } if (json['avg'] != null) { data.avg = json['avg']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyCloudrateToJson(WeatherModelResultDailyCloudrate entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['min'] = entity.min; data['avg'] = entity.avg; return data; } weatherModelResultDailyPressureFromJson(WeatherModelResultDailyPressure data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toDouble(); } if (json['min'] != null) { data.min = json['min']?.toDouble(); } if (json['avg'] != null) { data.avg = json['avg']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyPressureToJson(WeatherModelResultDailyPressure entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['min'] = entity.min; data['avg'] = entity.avg; return data; } weatherModelResultDailyVisibilityFromJson(WeatherModelResultDailyVisibility data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toDouble(); } if (json['min'] != null) { data.min = json['min']?.toDouble(); } if (json['avg'] != null) { data.avg = json['avg']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultDailyVisibilityToJson(WeatherModelResultDailyVisibility entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['min'] = entity.min; data['avg'] = entity.avg; return data; } weatherModelResultDailyDswrfFromJson(WeatherModelResultDailyDswrf data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toDouble(); } if (json['min'] != null) { data.min = json['min']?.toInt(); } if (json['avg'] != null) { data.avg = json['avg']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyDswrfToJson(WeatherModelResultDailyDswrf entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['min'] = entity.min; data['avg'] = entity.avg; return data; } weatherModelResultDailyAirQualityFromJson(WeatherModelResultDailyAirQuality data, Map<String, dynamic> json) { if (json['aqi'] != null) { data.aqi = new List<WeatherModelResultDailyAirQualityAqi>(); (json['aqi'] as List).forEach((v) { data.aqi.add(new WeatherModelResultDailyAirQualityAqi().fromJson(v)); }); } if (json['pm25'] != null) { data.pm25 = new List<WeatherModelResultDailyAirQualityPm25>(); (json['pm25'] as List).forEach((v) { data.pm25.add(new WeatherModelResultDailyAirQualityPm25().fromJson(v)); }); } return data; } Map<String, dynamic> weatherModelResultDailyAirQualityToJson(WeatherModelResultDailyAirQuality entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); if (entity.aqi != null) { data['aqi'] = entity.aqi.map((v) => v.toJson()).toList(); } if (entity.pm25 != null) { data['pm25'] = entity.pm25.map((v) => v.toJson()).toList(); } return data; } weatherModelResultDailyAirQualityAqiFromJson(WeatherModelResultDailyAirQualityAqi data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = new WeatherModelResultDailyAirQualityAqiMax().fromJson(json['max']); } if (json['avg'] != null) { data.avg = new WeatherModelResultDailyAirQualityAqiAvg().fromJson(json['avg']); } if (json['min'] != null) { data.min = new WeatherModelResultDailyAirQualityAqiMin().fromJson(json['min']); } return data; } Map<String, dynamic> weatherModelResultDailyAirQualityAqiToJson(WeatherModelResultDailyAirQualityAqi entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; if (entity.max != null) { data['max'] = entity.max.toJson(); } if (entity.avg != null) { data['avg'] = entity.avg.toJson(); } if (entity.min != null) { data['min'] = entity.min.toJson(); } return data; } weatherModelResultDailyAirQualityAqiMaxFromJson(WeatherModelResultDailyAirQualityAqiMax data, Map<String, dynamic> json) { if (json['chn'] != null) { data.chn = json['chn']?.toInt(); } if (json['usa'] != null) { data.usa = json['usa']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultDailyAirQualityAqiMaxToJson(WeatherModelResultDailyAirQualityAqiMax entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['chn'] = entity.chn; data['usa'] = entity.usa; return data; } weatherModelResultDailyAirQualityAqiAvgFromJson(WeatherModelResultDailyAirQualityAqiAvg data, Map<String, dynamic> json) { if (json['chn'] != null) { data.chn = json['chn']?.toDouble(); } if (json['usa'] != null) { data.usa = json['usa']?.toDouble(); } return data; } Map<String, dynamic> weatherModelResultDailyAirQualityAqiAvgToJson(WeatherModelResultDailyAirQualityAqiAvg entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['chn'] = entity.chn; data['usa'] = entity.usa; return data; } weatherModelResultDailyAirQualityAqiMinFromJson(WeatherModelResultDailyAirQualityAqiMin data, Map<String, dynamic> json) { if (json['chn'] != null) { data.chn = json['chn']?.toInt(); } if (json['usa'] != null) { data.usa = json['usa']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultDailyAirQualityAqiMinToJson(WeatherModelResultDailyAirQualityAqiMin entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['chn'] = entity.chn; data['usa'] = entity.usa; return data; } weatherModelResultDailyAirQualityPm25FromJson(WeatherModelResultDailyAirQualityPm25 data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['max'] != null) { data.max = json['max']?.toInt(); } if (json['avg'] != null) { data.avg = json['avg']?.toDouble(); } if (json['min'] != null) { data.min = json['min']?.toInt(); } return data; } Map<String, dynamic> weatherModelResultDailyAirQualityPm25ToJson(WeatherModelResultDailyAirQualityPm25 entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['max'] = entity.max; data['avg'] = entity.avg; data['min'] = entity.min; return data; } weatherModelResultDailySkyconFromJson(WeatherModelResultDailySkycon data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailySkyconToJson(WeatherModelResultDailySkycon entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['value'] = entity.value; return data; } weatherModelResultDailySkycon08h20hFromJson(WeatherModelResultDailySkycon08h20h data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailySkycon08h20hToJson(WeatherModelResultDailySkycon08h20h entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['value'] = entity.value; return data; } weatherModelResultDailySkycon20h32hFromJson(WeatherModelResultDailySkycon20h32h data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['value'] != null) { data.value = json['value']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailySkycon20h32hToJson(WeatherModelResultDailySkycon20h32h entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['value'] = entity.value; return data; } weatherModelResultDailyLifeIndexFromJson(WeatherModelResultDailyLifeIndex data, Map<String, dynamic> json) { if (json['ultraviolet'] != null) { data.ultraviolet = new List<WeatherModelResultDailyLifeIndexUltraviolet>(); (json['ultraviolet'] as List).forEach((v) { data.ultraviolet.add(new WeatherModelResultDailyLifeIndexUltraviolet().fromJson(v)); }); } if (json['carWashing'] != null) { data.carWashing = new List<WeatherModelResultDailyLifeIndexCarWashing>(); (json['carWashing'] as List).forEach((v) { data.carWashing.add(new WeatherModelResultDailyLifeIndexCarWashing().fromJson(v)); }); } if (json['dressing'] != null) { data.dressing = new List<WeatherModelResultDailyLifeIndexDressing>(); (json['dressing'] as List).forEach((v) { data.dressing.add(new WeatherModelResultDailyLifeIndexDressing().fromJson(v)); }); } if (json['comfort'] != null) { data.comfort = new List<WeatherModelResultDailyLifeIndexComfort>(); (json['comfort'] as List).forEach((v) { data.comfort.add(new WeatherModelResultDailyLifeIndexComfort().fromJson(v)); }); } if (json['coldRisk'] != null) { data.coldRisk = new List<WeatherModelResultDailyLifeIndexColdRisk>(); (json['coldRisk'] as List).forEach((v) { data.coldRisk.add(new WeatherModelResultDailyLifeIndexColdRisk().fromJson(v)); }); } return data; } Map<String, dynamic> weatherModelResultDailyLifeIndexToJson(WeatherModelResultDailyLifeIndex entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); if (entity.ultraviolet != null) { data['ultraviolet'] = entity.ultraviolet.map((v) => v.toJson()).toList(); } if (entity.carWashing != null) { data['carWashing'] = entity.carWashing.map((v) => v.toJson()).toList(); } if (entity.dressing != null) { data['dressing'] = entity.dressing.map((v) => v.toJson()).toList(); } if (entity.comfort != null) { data['comfort'] = entity.comfort.map((v) => v.toJson()).toList(); } if (entity.coldRisk != null) { data['coldRisk'] = entity.coldRisk.map((v) => v.toJson()).toList(); } return data; } weatherModelResultDailyLifeIndexUltravioletFromJson(WeatherModelResultDailyLifeIndexUltraviolet data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['index'] != null) { data.index = json['index']?.toString(); } if (json['desc'] != null) { data.desc = json['desc']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailyLifeIndexUltravioletToJson(WeatherModelResultDailyLifeIndexUltraviolet entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['index'] = entity.index; data['desc'] = entity.desc; return data; } weatherModelResultDailyLifeIndexCarWashingFromJson(WeatherModelResultDailyLifeIndexCarWashing data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['index'] != null) { data.index = json['index']?.toString(); } if (json['desc'] != null) { data.desc = json['desc']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailyLifeIndexCarWashingToJson(WeatherModelResultDailyLifeIndexCarWashing entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['index'] = entity.index; data['desc'] = entity.desc; return data; } weatherModelResultDailyLifeIndexDressingFromJson(WeatherModelResultDailyLifeIndexDressing data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['index'] != null) { data.index = json['index']?.toString(); } if (json['desc'] != null) { data.desc = json['desc']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailyLifeIndexDressingToJson(WeatherModelResultDailyLifeIndexDressing entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['index'] = entity.index; data['desc'] = entity.desc; return data; } weatherModelResultDailyLifeIndexComfortFromJson(WeatherModelResultDailyLifeIndexComfort data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['index'] != null) { data.index = json['index']?.toString(); } if (json['desc'] != null) { data.desc = json['desc']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailyLifeIndexComfortToJson(WeatherModelResultDailyLifeIndexComfort entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['index'] = entity.index; data['desc'] = entity.desc; return data; } weatherModelResultDailyLifeIndexColdRiskFromJson(WeatherModelResultDailyLifeIndexColdRisk data, Map<String, dynamic> json) { if (json['date'] != null) { data.date = json['date']?.toString(); } if (json['index'] != null) { data.index = json['index']?.toString(); } if (json['desc'] != null) { data.desc = json['desc']?.toString(); } return data; } Map<String, dynamic> weatherModelResultDailyLifeIndexColdRiskToJson(WeatherModelResultDailyLifeIndexColdRisk entity) { final Map<String, dynamic> data = new Map<String, dynamic>(); data['date'] = entity.date; data['index'] = entity.index; data['desc'] = entity.desc; return data; }
0
mirrored_repositories/SimplicityWeather/lib/generated/json
mirrored_repositories/SimplicityWeather/lib/generated/json/base/json_convert_content.dart
// ignore_for_file: non_constant_identifier_names // ignore_for_file: camel_case_types // ignore_for_file: prefer_single_quotes // This file is automatically generated. DO NOT EDIT, all your changes would be lost. import 'package:flutter_dynamic_weather/model/district_model_entity.dart'; import 'package:flutter_dynamic_weather/generated/json/district_model_entity_helper.dart'; import 'package:flutter_dynamic_weather/model/weather_model_entity.dart'; import 'package:flutter_dynamic_weather/generated/json/weather_model_entity_helper.dart'; class JsonConvert<T> { T fromJson(Map<String, dynamic> json) { return _getFromJson<T>(runtimeType, this, json); } Map<String, dynamic> toJson() { return _getToJson<T>(runtimeType, this); } static _getFromJson<T>(Type type, data, json) { switch (type) { case DistrictModelEntity: return districtModelEntityFromJson(data as DistrictModelEntity, json) as T; case DistrictModelDistrict: return districtModelDistrictFromJson(data as DistrictModelDistrict, json) as T; case DistrictModelDistrictsDistrict: return districtModelDistrictsDistrictFromJson(data as DistrictModelDistrictsDistrict, json) as T; case WeatherModelEntity: return weatherModelEntityFromJson(data as WeatherModelEntity, json) as T; case WeatherModelResult: return weatherModelResultFromJson(data as WeatherModelResult, json) as T; case WeatherModelResultRealtime: return weatherModelResultRealtimeFromJson(data as WeatherModelResultRealtime, json) as T; case WeatherModelResultRealtimeWind: return weatherModelResultRealtimeWindFromJson(data as WeatherModelResultRealtimeWind, json) as T; case WeatherModelResultRealtimePrecipitation: return weatherModelResultRealtimePrecipitationFromJson(data as WeatherModelResultRealtimePrecipitation, json) as T; case WeatherModelResultRealtimePrecipitationLocal: return weatherModelResultRealtimePrecipitationLocalFromJson(data as WeatherModelResultRealtimePrecipitationLocal, json) as T; case WeatherModelResultRealtimePrecipitationNearest: return weatherModelResultRealtimePrecipitationNearestFromJson(data as WeatherModelResultRealtimePrecipitationNearest, json) as T; case WeatherModelResultRealtimeAirQuality: return weatherModelResultRealtimeAirQualityFromJson(data as WeatherModelResultRealtimeAirQuality, json) as T; case WeatherModelResultRealtimeAirQualityAqi: return weatherModelResultRealtimeAirQualityAqiFromJson(data as WeatherModelResultRealtimeAirQualityAqi, json) as T; case WeatherModelResultRealtimeAirQualityDescription: return weatherModelResultRealtimeAirQualityDescriptionFromJson(data as WeatherModelResultRealtimeAirQualityDescription, json) as T; case WeatherModelResultRealtimeLifeIndex: return weatherModelResultRealtimeLifeIndexFromJson(data as WeatherModelResultRealtimeLifeIndex, json) as T; case WeatherModelResultRealtimeLifeIndexUltraviolet: return weatherModelResultRealtimeLifeIndexUltravioletFromJson(data as WeatherModelResultRealtimeLifeIndexUltraviolet, json) as T; case WeatherModelResultRealtimeLifeIndexComfort: return weatherModelResultRealtimeLifeIndexComfortFromJson(data as WeatherModelResultRealtimeLifeIndexComfort, json) as T; case WeatherModelResultMinutely: return weatherModelResultMinutelyFromJson(data as WeatherModelResultMinutely, json) as T; case WeatherModelResultHourly: return weatherModelResultHourlyFromJson(data as WeatherModelResultHourly, json) as T; case WeatherModelResultHourlyPrecipitation: return weatherModelResultHourlyPrecipitationFromJson(data as WeatherModelResultHourlyPrecipitation, json) as T; case WeatherModelResultHourlyTemperature: return weatherModelResultHourlyTemperatureFromJson(data as WeatherModelResultHourlyTemperature, json) as T; case WeatherModelResultHourlyWind: return weatherModelResultHourlyWindFromJson(data as WeatherModelResultHourlyWind, json) as T; case WeatherModelResultHourlyHumidity: return weatherModelResultHourlyHumidityFromJson(data as WeatherModelResultHourlyHumidity, json) as T; case WeatherModelResultHourlyCloudrate: return weatherModelResultHourlyCloudrateFromJson(data as WeatherModelResultHourlyCloudrate, json) as T; case WeatherModelResultHourlySkycon: return weatherModelResultHourlySkyconFromJson(data as WeatherModelResultHourlySkycon, json) as T; case WeatherModelResultHourlyPressure: return weatherModelResultHourlyPressureFromJson(data as WeatherModelResultHourlyPressure, json) as T; case WeatherModelResultHourlyVisibility: return weatherModelResultHourlyVisibilityFromJson(data as WeatherModelResultHourlyVisibility, json) as T; case WeatherModelResultHourlyDswrf: return weatherModelResultHourlyDswrfFromJson(data as WeatherModelResultHourlyDswrf, json) as T; case WeatherModelResultHourlyAirQuality: return weatherModelResultHourlyAirQualityFromJson(data as WeatherModelResultHourlyAirQuality, json) as T; case WeatherModelResultHourlyAirQualityAqi: return weatherModelResultHourlyAirQualityAqiFromJson(data as WeatherModelResultHourlyAirQualityAqi, json) as T; case WeatherModelResultHourlyAirQualityAqiValue: return weatherModelResultHourlyAirQualityAqiValueFromJson(data as WeatherModelResultHourlyAirQualityAqiValue, json) as T; case WeatherModelResultHourlyAirQualityPm25: return weatherModelResultHourlyAirQualityPm25FromJson(data as WeatherModelResultHourlyAirQualityPm25, json) as T; case WeatherModelResultDaily: return weatherModelResultDailyFromJson(data as WeatherModelResultDaily, json) as T; case WeatherModelResultDailyAstro: return weatherModelResultDailyAstroFromJson(data as WeatherModelResultDailyAstro, json) as T; case WeatherModelResultDailyAstroSunrise: return weatherModelResultDailyAstroSunriseFromJson(data as WeatherModelResultDailyAstroSunrise, json) as T; case WeatherModelResultDailyAstroSunset: return weatherModelResultDailyAstroSunsetFromJson(data as WeatherModelResultDailyAstroSunset, json) as T; case WeatherModelResultDailyPrecipitation: return weatherModelResultDailyPrecipitationFromJson(data as WeatherModelResultDailyPrecipitation, json) as T; case WeatherModelResultDailyTemperature: return weatherModelResultDailyTemperatureFromJson(data as WeatherModelResultDailyTemperature, json) as T; case WeatherModelResultDailyWind: return weatherModelResultDailyWindFromJson(data as WeatherModelResultDailyWind, json) as T; case WeatherModelResultDailyWindMax: return weatherModelResultDailyWindMaxFromJson(data as WeatherModelResultDailyWindMax, json) as T; case WeatherModelResultDailyWindMin: return weatherModelResultDailyWindMinFromJson(data as WeatherModelResultDailyWindMin, json) as T; case WeatherModelResultDailyWindAvg: return weatherModelResultDailyWindAvgFromJson(data as WeatherModelResultDailyWindAvg, json) as T; case WeatherModelResultDailyHumidity: return weatherModelResultDailyHumidityFromJson(data as WeatherModelResultDailyHumidity, json) as T; case WeatherModelResultDailyCloudrate: return weatherModelResultDailyCloudrateFromJson(data as WeatherModelResultDailyCloudrate, json) as T; case WeatherModelResultDailyPressure: return weatherModelResultDailyPressureFromJson(data as WeatherModelResultDailyPressure, json) as T; case WeatherModelResultDailyVisibility: return weatherModelResultDailyVisibilityFromJson(data as WeatherModelResultDailyVisibility, json) as T; case WeatherModelResultDailyDswrf: return weatherModelResultDailyDswrfFromJson(data as WeatherModelResultDailyDswrf, json) as T; case WeatherModelResultDailyAirQuality: return weatherModelResultDailyAirQualityFromJson(data as WeatherModelResultDailyAirQuality, json) as T; case WeatherModelResultDailyAirQualityAqi: return weatherModelResultDailyAirQualityAqiFromJson(data as WeatherModelResultDailyAirQualityAqi, json) as T; case WeatherModelResultDailyAirQualityAqiMax: return weatherModelResultDailyAirQualityAqiMaxFromJson(data as WeatherModelResultDailyAirQualityAqiMax, json) as T; case WeatherModelResultDailyAirQualityAqiAvg: return weatherModelResultDailyAirQualityAqiAvgFromJson(data as WeatherModelResultDailyAirQualityAqiAvg, json) as T; case WeatherModelResultDailyAirQualityAqiMin: return weatherModelResultDailyAirQualityAqiMinFromJson(data as WeatherModelResultDailyAirQualityAqiMin, json) as T; case WeatherModelResultDailyAirQualityPm25: return weatherModelResultDailyAirQualityPm25FromJson(data as WeatherModelResultDailyAirQualityPm25, json) as T; case WeatherModelResultDailySkycon: return weatherModelResultDailySkyconFromJson(data as WeatherModelResultDailySkycon, json) as T; case WeatherModelResultDailySkycon08h20h: return weatherModelResultDailySkycon08h20hFromJson(data as WeatherModelResultDailySkycon08h20h, json) as T; case WeatherModelResultDailySkycon20h32h: return weatherModelResultDailySkycon20h32hFromJson(data as WeatherModelResultDailySkycon20h32h, json) as T; case WeatherModelResultDailyLifeIndex: return weatherModelResultDailyLifeIndexFromJson(data as WeatherModelResultDailyLifeIndex, json) as T; case WeatherModelResultDailyLifeIndexUltraviolet: return weatherModelResultDailyLifeIndexUltravioletFromJson(data as WeatherModelResultDailyLifeIndexUltraviolet, json) as T; case WeatherModelResultDailyLifeIndexCarWashing: return weatherModelResultDailyLifeIndexCarWashingFromJson(data as WeatherModelResultDailyLifeIndexCarWashing, json) as T; case WeatherModelResultDailyLifeIndexDressing: return weatherModelResultDailyLifeIndexDressingFromJson(data as WeatherModelResultDailyLifeIndexDressing, json) as T; case WeatherModelResultDailyLifeIndexComfort: return weatherModelResultDailyLifeIndexComfortFromJson(data as WeatherModelResultDailyLifeIndexComfort, json) as T; case WeatherModelResultDailyLifeIndexColdRisk: return weatherModelResultDailyLifeIndexColdRiskFromJson(data as WeatherModelResultDailyLifeIndexColdRisk, json) as T; } return data as T; } static _getToJson<T>(Type type, data) { switch (type) { case DistrictModelEntity: return districtModelEntityToJson(data as DistrictModelEntity); case DistrictModelDistrict: return districtModelDistrictToJson(data as DistrictModelDistrict); case DistrictModelDistrictsDistrict: return districtModelDistrictsDistrictToJson(data as DistrictModelDistrictsDistrict); case WeatherModelEntity: return weatherModelEntityToJson(data as WeatherModelEntity); case WeatherModelResult: return weatherModelResultToJson(data as WeatherModelResult); case WeatherModelResultRealtime: return weatherModelResultRealtimeToJson(data as WeatherModelResultRealtime); case WeatherModelResultRealtimeWind: return weatherModelResultRealtimeWindToJson(data as WeatherModelResultRealtimeWind); case WeatherModelResultRealtimePrecipitation: return weatherModelResultRealtimePrecipitationToJson(data as WeatherModelResultRealtimePrecipitation); case WeatherModelResultRealtimePrecipitationLocal: return weatherModelResultRealtimePrecipitationLocalToJson(data as WeatherModelResultRealtimePrecipitationLocal); case WeatherModelResultRealtimePrecipitationNearest: return weatherModelResultRealtimePrecipitationNearestToJson(data as WeatherModelResultRealtimePrecipitationNearest); case WeatherModelResultRealtimeAirQuality: return weatherModelResultRealtimeAirQualityToJson(data as WeatherModelResultRealtimeAirQuality); case WeatherModelResultRealtimeAirQualityAqi: return weatherModelResultRealtimeAirQualityAqiToJson(data as WeatherModelResultRealtimeAirQualityAqi); case WeatherModelResultRealtimeAirQualityDescription: return weatherModelResultRealtimeAirQualityDescriptionToJson(data as WeatherModelResultRealtimeAirQualityDescription); case WeatherModelResultRealtimeLifeIndex: return weatherModelResultRealtimeLifeIndexToJson(data as WeatherModelResultRealtimeLifeIndex); case WeatherModelResultRealtimeLifeIndexUltraviolet: return weatherModelResultRealtimeLifeIndexUltravioletToJson(data as WeatherModelResultRealtimeLifeIndexUltraviolet); case WeatherModelResultRealtimeLifeIndexComfort: return weatherModelResultRealtimeLifeIndexComfortToJson(data as WeatherModelResultRealtimeLifeIndexComfort); case WeatherModelResultMinutely: return weatherModelResultMinutelyToJson(data as WeatherModelResultMinutely); case WeatherModelResultHourly: return weatherModelResultHourlyToJson(data as WeatherModelResultHourly); case WeatherModelResultHourlyPrecipitation: return weatherModelResultHourlyPrecipitationToJson(data as WeatherModelResultHourlyPrecipitation); case WeatherModelResultHourlyTemperature: return weatherModelResultHourlyTemperatureToJson(data as WeatherModelResultHourlyTemperature); case WeatherModelResultHourlyWind: return weatherModelResultHourlyWindToJson(data as WeatherModelResultHourlyWind); case WeatherModelResultHourlyHumidity: return weatherModelResultHourlyHumidityToJson(data as WeatherModelResultHourlyHumidity); case WeatherModelResultHourlyCloudrate: return weatherModelResultHourlyCloudrateToJson(data as WeatherModelResultHourlyCloudrate); case WeatherModelResultHourlySkycon: return weatherModelResultHourlySkyconToJson(data as WeatherModelResultHourlySkycon); case WeatherModelResultHourlyPressure: return weatherModelResultHourlyPressureToJson(data as WeatherModelResultHourlyPressure); case WeatherModelResultHourlyVisibility: return weatherModelResultHourlyVisibilityToJson(data as WeatherModelResultHourlyVisibility); case WeatherModelResultHourlyDswrf: return weatherModelResultHourlyDswrfToJson(data as WeatherModelResultHourlyDswrf); case WeatherModelResultHourlyAirQuality: return weatherModelResultHourlyAirQualityToJson(data as WeatherModelResultHourlyAirQuality); case WeatherModelResultHourlyAirQualityAqi: return weatherModelResultHourlyAirQualityAqiToJson(data as WeatherModelResultHourlyAirQualityAqi); case WeatherModelResultHourlyAirQualityAqiValue: return weatherModelResultHourlyAirQualityAqiValueToJson(data as WeatherModelResultHourlyAirQualityAqiValue); case WeatherModelResultHourlyAirQualityPm25: return weatherModelResultHourlyAirQualityPm25ToJson(data as WeatherModelResultHourlyAirQualityPm25); case WeatherModelResultDaily: return weatherModelResultDailyToJson(data as WeatherModelResultDaily); case WeatherModelResultDailyAstro: return weatherModelResultDailyAstroToJson(data as WeatherModelResultDailyAstro); case WeatherModelResultDailyAstroSunrise: return weatherModelResultDailyAstroSunriseToJson(data as WeatherModelResultDailyAstroSunrise); case WeatherModelResultDailyAstroSunset: return weatherModelResultDailyAstroSunsetToJson(data as WeatherModelResultDailyAstroSunset); case WeatherModelResultDailyPrecipitation: return weatherModelResultDailyPrecipitationToJson(data as WeatherModelResultDailyPrecipitation); case WeatherModelResultDailyTemperature: return weatherModelResultDailyTemperatureToJson(data as WeatherModelResultDailyTemperature); case WeatherModelResultDailyWind: return weatherModelResultDailyWindToJson(data as WeatherModelResultDailyWind); case WeatherModelResultDailyWindMax: return weatherModelResultDailyWindMaxToJson(data as WeatherModelResultDailyWindMax); case WeatherModelResultDailyWindMin: return weatherModelResultDailyWindMinToJson(data as WeatherModelResultDailyWindMin); case WeatherModelResultDailyWindAvg: return weatherModelResultDailyWindAvgToJson(data as WeatherModelResultDailyWindAvg); case WeatherModelResultDailyHumidity: return weatherModelResultDailyHumidityToJson(data as WeatherModelResultDailyHumidity); case WeatherModelResultDailyCloudrate: return weatherModelResultDailyCloudrateToJson(data as WeatherModelResultDailyCloudrate); case WeatherModelResultDailyPressure: return weatherModelResultDailyPressureToJson(data as WeatherModelResultDailyPressure); case WeatherModelResultDailyVisibility: return weatherModelResultDailyVisibilityToJson(data as WeatherModelResultDailyVisibility); case WeatherModelResultDailyDswrf: return weatherModelResultDailyDswrfToJson(data as WeatherModelResultDailyDswrf); case WeatherModelResultDailyAirQuality: return weatherModelResultDailyAirQualityToJson(data as WeatherModelResultDailyAirQuality); case WeatherModelResultDailyAirQualityAqi: return weatherModelResultDailyAirQualityAqiToJson(data as WeatherModelResultDailyAirQualityAqi); case WeatherModelResultDailyAirQualityAqiMax: return weatherModelResultDailyAirQualityAqiMaxToJson(data as WeatherModelResultDailyAirQualityAqiMax); case WeatherModelResultDailyAirQualityAqiAvg: return weatherModelResultDailyAirQualityAqiAvgToJson(data as WeatherModelResultDailyAirQualityAqiAvg); case WeatherModelResultDailyAirQualityAqiMin: return weatherModelResultDailyAirQualityAqiMinToJson(data as WeatherModelResultDailyAirQualityAqiMin); case WeatherModelResultDailyAirQualityPm25: return weatherModelResultDailyAirQualityPm25ToJson(data as WeatherModelResultDailyAirQualityPm25); case WeatherModelResultDailySkycon: return weatherModelResultDailySkyconToJson(data as WeatherModelResultDailySkycon); case WeatherModelResultDailySkycon08h20h: return weatherModelResultDailySkycon08h20hToJson(data as WeatherModelResultDailySkycon08h20h); case WeatherModelResultDailySkycon20h32h: return weatherModelResultDailySkycon20h32hToJson(data as WeatherModelResultDailySkycon20h32h); case WeatherModelResultDailyLifeIndex: return weatherModelResultDailyLifeIndexToJson(data as WeatherModelResultDailyLifeIndex); case WeatherModelResultDailyLifeIndexUltraviolet: return weatherModelResultDailyLifeIndexUltravioletToJson(data as WeatherModelResultDailyLifeIndexUltraviolet); case WeatherModelResultDailyLifeIndexCarWashing: return weatherModelResultDailyLifeIndexCarWashingToJson(data as WeatherModelResultDailyLifeIndexCarWashing); case WeatherModelResultDailyLifeIndexDressing: return weatherModelResultDailyLifeIndexDressingToJson(data as WeatherModelResultDailyLifeIndexDressing); case WeatherModelResultDailyLifeIndexComfort: return weatherModelResultDailyLifeIndexComfortToJson(data as WeatherModelResultDailyLifeIndexComfort); case WeatherModelResultDailyLifeIndexColdRisk: return weatherModelResultDailyLifeIndexColdRiskToJson(data as WeatherModelResultDailyLifeIndexColdRisk); } return data as T; } //Go back to a single instance by type static _fromJsonSingle(String type, json) { switch (type) { case 'DistrictModelEntity': return DistrictModelEntity().fromJson(json); case 'DistrictModelDistrict': return DistrictModelDistrict().fromJson(json); case 'DistrictModelDistrictsDistrict': return DistrictModelDistrictsDistrict().fromJson(json); case 'WeatherModelEntity': return WeatherModelEntity().fromJson(json); case 'WeatherModelResult': return WeatherModelResult().fromJson(json); case 'WeatherModelResultRealtime': return WeatherModelResultRealtime().fromJson(json); case 'WeatherModelResultRealtimeWind': return WeatherModelResultRealtimeWind().fromJson(json); case 'WeatherModelResultRealtimePrecipitation': return WeatherModelResultRealtimePrecipitation().fromJson(json); case 'WeatherModelResultRealtimePrecipitationLocal': return WeatherModelResultRealtimePrecipitationLocal().fromJson(json); case 'WeatherModelResultRealtimePrecipitationNearest': return WeatherModelResultRealtimePrecipitationNearest().fromJson(json); case 'WeatherModelResultRealtimeAirQuality': return WeatherModelResultRealtimeAirQuality().fromJson(json); case 'WeatherModelResultRealtimeAirQualityAqi': return WeatherModelResultRealtimeAirQualityAqi().fromJson(json); case 'WeatherModelResultRealtimeAirQualityDescription': return WeatherModelResultRealtimeAirQualityDescription().fromJson(json); case 'WeatherModelResultRealtimeLifeIndex': return WeatherModelResultRealtimeLifeIndex().fromJson(json); case 'WeatherModelResultRealtimeLifeIndexUltraviolet': return WeatherModelResultRealtimeLifeIndexUltraviolet().fromJson(json); case 'WeatherModelResultRealtimeLifeIndexComfort': return WeatherModelResultRealtimeLifeIndexComfort().fromJson(json); case 'WeatherModelResultMinutely': return WeatherModelResultMinutely().fromJson(json); case 'WeatherModelResultHourly': return WeatherModelResultHourly().fromJson(json); case 'WeatherModelResultHourlyPrecipitation': return WeatherModelResultHourlyPrecipitation().fromJson(json); case 'WeatherModelResultHourlyTemperature': return WeatherModelResultHourlyTemperature().fromJson(json); case 'WeatherModelResultHourlyWind': return WeatherModelResultHourlyWind().fromJson(json); case 'WeatherModelResultHourlyHumidity': return WeatherModelResultHourlyHumidity().fromJson(json); case 'WeatherModelResultHourlyCloudrate': return WeatherModelResultHourlyCloudrate().fromJson(json); case 'WeatherModelResultHourlySkycon': return WeatherModelResultHourlySkycon().fromJson(json); case 'WeatherModelResultHourlyPressure': return WeatherModelResultHourlyPressure().fromJson(json); case 'WeatherModelResultHourlyVisibility': return WeatherModelResultHourlyVisibility().fromJson(json); case 'WeatherModelResultHourlyDswrf': return WeatherModelResultHourlyDswrf().fromJson(json); case 'WeatherModelResultHourlyAirQuality': return WeatherModelResultHourlyAirQuality().fromJson(json); case 'WeatherModelResultHourlyAirQualityAqi': return WeatherModelResultHourlyAirQualityAqi().fromJson(json); case 'WeatherModelResultHourlyAirQualityAqiValue': return WeatherModelResultHourlyAirQualityAqiValue().fromJson(json); case 'WeatherModelResultHourlyAirQualityPm25': return WeatherModelResultHourlyAirQualityPm25().fromJson(json); case 'WeatherModelResultDaily': return WeatherModelResultDaily().fromJson(json); case 'WeatherModelResultDailyAstro': return WeatherModelResultDailyAstro().fromJson(json); case 'WeatherModelResultDailyAstroSunrise': return WeatherModelResultDailyAstroSunrise().fromJson(json); case 'WeatherModelResultDailyAstroSunset': return WeatherModelResultDailyAstroSunset().fromJson(json); case 'WeatherModelResultDailyPrecipitation': return WeatherModelResultDailyPrecipitation().fromJson(json); case 'WeatherModelResultDailyTemperature': return WeatherModelResultDailyTemperature().fromJson(json); case 'WeatherModelResultDailyWind': return WeatherModelResultDailyWind().fromJson(json); case 'WeatherModelResultDailyWindMax': return WeatherModelResultDailyWindMax().fromJson(json); case 'WeatherModelResultDailyWindMin': return WeatherModelResultDailyWindMin().fromJson(json); case 'WeatherModelResultDailyWindAvg': return WeatherModelResultDailyWindAvg().fromJson(json); case 'WeatherModelResultDailyHumidity': return WeatherModelResultDailyHumidity().fromJson(json); case 'WeatherModelResultDailyCloudrate': return WeatherModelResultDailyCloudrate().fromJson(json); case 'WeatherModelResultDailyPressure': return WeatherModelResultDailyPressure().fromJson(json); case 'WeatherModelResultDailyVisibility': return WeatherModelResultDailyVisibility().fromJson(json); case 'WeatherModelResultDailyDswrf': return WeatherModelResultDailyDswrf().fromJson(json); case 'WeatherModelResultDailyAirQuality': return WeatherModelResultDailyAirQuality().fromJson(json); case 'WeatherModelResultDailyAirQualityAqi': return WeatherModelResultDailyAirQualityAqi().fromJson(json); case 'WeatherModelResultDailyAirQualityAqiMax': return WeatherModelResultDailyAirQualityAqiMax().fromJson(json); case 'WeatherModelResultDailyAirQualityAqiAvg': return WeatherModelResultDailyAirQualityAqiAvg().fromJson(json); case 'WeatherModelResultDailyAirQualityAqiMin': return WeatherModelResultDailyAirQualityAqiMin().fromJson(json); case 'WeatherModelResultDailyAirQualityPm25': return WeatherModelResultDailyAirQualityPm25().fromJson(json); case 'WeatherModelResultDailySkycon': return WeatherModelResultDailySkycon().fromJson(json); case 'WeatherModelResultDailySkycon08h20h': return WeatherModelResultDailySkycon08h20h().fromJson(json); case 'WeatherModelResultDailySkycon20h32h': return WeatherModelResultDailySkycon20h32h().fromJson(json); case 'WeatherModelResultDailyLifeIndex': return WeatherModelResultDailyLifeIndex().fromJson(json); case 'WeatherModelResultDailyLifeIndexUltraviolet': return WeatherModelResultDailyLifeIndexUltraviolet().fromJson(json); case 'WeatherModelResultDailyLifeIndexCarWashing': return WeatherModelResultDailyLifeIndexCarWashing().fromJson(json); case 'WeatherModelResultDailyLifeIndexDressing': return WeatherModelResultDailyLifeIndexDressing().fromJson(json); case 'WeatherModelResultDailyLifeIndexComfort': return WeatherModelResultDailyLifeIndexComfort().fromJson(json); case 'WeatherModelResultDailyLifeIndexColdRisk': return WeatherModelResultDailyLifeIndexColdRisk().fromJson(json); } return null; } //empty list is returned by type static _getListFromType(String type) { switch (type) { case 'DistrictModelEntity': return List<DistrictModelEntity>(); case 'DistrictModelDistrict': return List<DistrictModelDistrict>(); case 'DistrictModelDistrictsDistrict': return List<DistrictModelDistrictsDistrict>(); case 'WeatherModelEntity': return List<WeatherModelEntity>(); case 'WeatherModelResult': return List<WeatherModelResult>(); case 'WeatherModelResultRealtime': return List<WeatherModelResultRealtime>(); case 'WeatherModelResultRealtimeWind': return List<WeatherModelResultRealtimeWind>(); case 'WeatherModelResultRealtimePrecipitation': return List<WeatherModelResultRealtimePrecipitation>(); case 'WeatherModelResultRealtimePrecipitationLocal': return List<WeatherModelResultRealtimePrecipitationLocal>(); case 'WeatherModelResultRealtimePrecipitationNearest': return List<WeatherModelResultRealtimePrecipitationNearest>(); case 'WeatherModelResultRealtimeAirQuality': return List<WeatherModelResultRealtimeAirQuality>(); case 'WeatherModelResultRealtimeAirQualityAqi': return List<WeatherModelResultRealtimeAirQualityAqi>(); case 'WeatherModelResultRealtimeAirQualityDescription': return List<WeatherModelResultRealtimeAirQualityDescription>(); case 'WeatherModelResultRealtimeLifeIndex': return List<WeatherModelResultRealtimeLifeIndex>(); case 'WeatherModelResultRealtimeLifeIndexUltraviolet': return List<WeatherModelResultRealtimeLifeIndexUltraviolet>(); case 'WeatherModelResultRealtimeLifeIndexComfort': return List<WeatherModelResultRealtimeLifeIndexComfort>(); case 'WeatherModelResultMinutely': return List<WeatherModelResultMinutely>(); case 'WeatherModelResultHourly': return List<WeatherModelResultHourly>(); case 'WeatherModelResultHourlyPrecipitation': return List<WeatherModelResultHourlyPrecipitation>(); case 'WeatherModelResultHourlyTemperature': return List<WeatherModelResultHourlyTemperature>(); case 'WeatherModelResultHourlyWind': return List<WeatherModelResultHourlyWind>(); case 'WeatherModelResultHourlyHumidity': return List<WeatherModelResultHourlyHumidity>(); case 'WeatherModelResultHourlyCloudrate': return List<WeatherModelResultHourlyCloudrate>(); case 'WeatherModelResultHourlySkycon': return List<WeatherModelResultHourlySkycon>(); case 'WeatherModelResultHourlyPressure': return List<WeatherModelResultHourlyPressure>(); case 'WeatherModelResultHourlyVisibility': return List<WeatherModelResultHourlyVisibility>(); case 'WeatherModelResultHourlyDswrf': return List<WeatherModelResultHourlyDswrf>(); case 'WeatherModelResultHourlyAirQuality': return List<WeatherModelResultHourlyAirQuality>(); case 'WeatherModelResultHourlyAirQualityAqi': return List<WeatherModelResultHourlyAirQualityAqi>(); case 'WeatherModelResultHourlyAirQualityAqiValue': return List<WeatherModelResultHourlyAirQualityAqiValue>(); case 'WeatherModelResultHourlyAirQualityPm25': return List<WeatherModelResultHourlyAirQualityPm25>(); case 'WeatherModelResultDaily': return List<WeatherModelResultDaily>(); case 'WeatherModelResultDailyAstro': return List<WeatherModelResultDailyAstro>(); case 'WeatherModelResultDailyAstroSunrise': return List<WeatherModelResultDailyAstroSunrise>(); case 'WeatherModelResultDailyAstroSunset': return List<WeatherModelResultDailyAstroSunset>(); case 'WeatherModelResultDailyPrecipitation': return List<WeatherModelResultDailyPrecipitation>(); case 'WeatherModelResultDailyTemperature': return List<WeatherModelResultDailyTemperature>(); case 'WeatherModelResultDailyWind': return List<WeatherModelResultDailyWind>(); case 'WeatherModelResultDailyWindMax': return List<WeatherModelResultDailyWindMax>(); case 'WeatherModelResultDailyWindMin': return List<WeatherModelResultDailyWindMin>(); case 'WeatherModelResultDailyWindAvg': return List<WeatherModelResultDailyWindAvg>(); case 'WeatherModelResultDailyHumidity': return List<WeatherModelResultDailyHumidity>(); case 'WeatherModelResultDailyCloudrate': return List<WeatherModelResultDailyCloudrate>(); case 'WeatherModelResultDailyPressure': return List<WeatherModelResultDailyPressure>(); case 'WeatherModelResultDailyVisibility': return List<WeatherModelResultDailyVisibility>(); case 'WeatherModelResultDailyDswrf': return List<WeatherModelResultDailyDswrf>(); case 'WeatherModelResultDailyAirQuality': return List<WeatherModelResultDailyAirQuality>(); case 'WeatherModelResultDailyAirQualityAqi': return List<WeatherModelResultDailyAirQualityAqi>(); case 'WeatherModelResultDailyAirQualityAqiMax': return List<WeatherModelResultDailyAirQualityAqiMax>(); case 'WeatherModelResultDailyAirQualityAqiAvg': return List<WeatherModelResultDailyAirQualityAqiAvg>(); case 'WeatherModelResultDailyAirQualityAqiMin': return List<WeatherModelResultDailyAirQualityAqiMin>(); case 'WeatherModelResultDailyAirQualityPm25': return List<WeatherModelResultDailyAirQualityPm25>(); case 'WeatherModelResultDailySkycon': return List<WeatherModelResultDailySkycon>(); case 'WeatherModelResultDailySkycon08h20h': return List<WeatherModelResultDailySkycon08h20h>(); case 'WeatherModelResultDailySkycon20h32h': return List<WeatherModelResultDailySkycon20h32h>(); case 'WeatherModelResultDailyLifeIndex': return List<WeatherModelResultDailyLifeIndex>(); case 'WeatherModelResultDailyLifeIndexUltraviolet': return List<WeatherModelResultDailyLifeIndexUltraviolet>(); case 'WeatherModelResultDailyLifeIndexCarWashing': return List<WeatherModelResultDailyLifeIndexCarWashing>(); case 'WeatherModelResultDailyLifeIndexDressing': return List<WeatherModelResultDailyLifeIndexDressing>(); case 'WeatherModelResultDailyLifeIndexComfort': return List<WeatherModelResultDailyLifeIndexComfort>(); case 'WeatherModelResultDailyLifeIndexColdRisk': return List<WeatherModelResultDailyLifeIndexColdRisk>(); } return null; } static M fromJsonAsT<M>(json) { String type = M.toString(); if (json is List && type.contains("List<")) { String itemType = type.substring(5, type.length - 1); List tempList = _getListFromType(itemType); json.forEach((itemJson) { tempList .add(_fromJsonSingle(type.substring(5, type.length - 1), itemJson)); }); return tempList as M; } else { return _fromJsonSingle(M.toString(), json) as M; } } }
0
mirrored_repositories/SimplicityWeather/lib/generated/json
mirrored_repositories/SimplicityWeather/lib/generated/json/base/json_field.dart
// ignore_for_file: non_constant_identifier_names // ignore_for_file: camel_case_types // ignore_for_file: prefer_single_quotes // This file is automatically generated. DO NOT EDIT, all your changes would be lost. class JSONField { //Specify the parse field name final String name; //Specify the time resolution format final String format; //Whether to participate in toJson final bool serialize; //Whether to participate in fromMap final bool deserialize; const JSONField({this.name, this.format, this.serialize, this.deserialize}); }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/net/code.dart
//import 'package:gsy_github_app_flutter/common/event/http_error_event.dart'; //import 'package:gsy_github_app_flutter/common/event/index.dart'; ///错误编码 class Code { ///网络错误 static const NETWORK_ERROR = -1; ///网络超时 static const NETWORK_TIMEOUT = -2; ///网络返回数据格式化一次 static const NETWORK_JSON_EXCEPTION = -3; ///Github APi Connection refused static const GITHUB_API_REFUSED = -4; static const SUCCESS = 200; static errorHandleFunction(code, message, noTip) { if (noTip) { return message; } if(message != null && message is String && (message.contains("Connection refused") || message.contains("Connection reset"))) { code = GITHUB_API_REFUSED; } return message; } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/net/net_manager.dart
import 'package:dio/dio.dart'; import 'package:flutter_dynamic_weather/net/code.dart'; import 'package:flutter_dynamic_weather/net/rep_result.dart'; import 'package:flutter_dynamic_weather/net/response_interceptor.dart'; const String weatherBaseUrl = "https://api.caiyunapp.com/v2.5/sas9gfwyRX2NVehl/"; const String cityBaseUrl = "https://restapi.amap.com/v3/config/district?subdistrict=1&key=请使用自己的key&keywords="; const String geoBaseUrl = "https://restapi.amap.com/v3/geocode/regeo?key=请使用自己的key&location="; const String otaBaseUrl = "http://xiaweizi.online/config/ota/"; const int _kReceiveTimeout = 15000; const int _kSendTimeout = 15000; const int _kConnectTimeout = 15000; ///http请求 class NetManager { static NetManager _instance = NetManager._internal(); Dio _dio; ///通用全局单例,第一次使用时初始化 NetManager._internal({String token}) { if (null == _dio) { _dio = Dio(BaseOptions( baseUrl: weatherBaseUrl, connectTimeout: _kReceiveTimeout, receiveTimeout: _kConnectTimeout, sendTimeout: _kSendTimeout, )); } _dio.interceptors.add(LogInterceptor()); _dio.interceptors.add(ResponseInterceptors()); } static NetManager getInstance() { return _instance; } baseUrl(String baseUrl) { _dio.options.baseUrl = baseUrl; return _instance; } Future<RepResult> get(String url, {Map<String, dynamic> header, Map<String, dynamic> param}) async { Response response; try { response = await _dio.get(url, queryParameters: param); } on DioError catch (e) { return resultError(e); } if (response.data is DioError) { return resultError(response.data); } return response.data; } resultError(DioError e) { Response errorResponse; if (e.response != null) { errorResponse = e.response; } else { errorResponse = Response(statusCode: 666); } if (e.type == DioErrorType.CONNECT_TIMEOUT || e.type == DioErrorType.RECEIVE_TIMEOUT) { errorResponse.statusCode = Code.NETWORK_TIMEOUT; } return RepResult( Code.errorHandleFunction(errorResponse.statusCode, e.message, false), false, errorResponse.statusCode); } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/net/weather_api.dart
import 'package:flutter/services.dart'; import 'package:flutter_dynamic_weather/model/district_model_entity.dart'; import 'package:flutter_dynamic_weather/net/net_manager.dart'; class WeatherApi { Future<dynamic> loadWeatherData(String longitude, String latitude) async { // WeatherModelEntity data = await WeatherApi.loadWeatherData("121.6544","25.1552"); var res = await NetManager.getInstance().baseUrl(weatherBaseUrl).get("$longitude,$latitude/weather.json"); if (res != null && res.status) { return res.data; } return null; } // https://api.caiyunapp.com/v2.5/sas9gfwyRX2NVehl/121.6544,25.1552/minutely.json Future<dynamic> loadMinuteData(String longitude, String latitude) async { // WeatherModelEntity data = await WeatherApi.loadWeatherData("121.6544","25.1552"); var res = await NetManager.getInstance().baseUrl(weatherBaseUrl).get("$longitude,$latitude/minutely.json"); if (res != null && res.status) { return res.data; } return null; } Future<DistrictModelEntity> searchCity(String keywords) async { // WeatherModelEntity data = await WeatherApi.loadWeatherData("121.6544","25.1552"); var res = await NetManager.getInstance().baseUrl(cityBaseUrl).get("$keywords"); if (res != null && res.status) { return DistrictModelEntity().fromJson(res.data); } return null; } Future<dynamic> reGeo(String location) async { // WeatherModelEntity data = await WeatherApi.loadWeatherData("121.6544","25.1552"); var res = await NetManager.getInstance().baseUrl(geoBaseUrl).get("$location"); if (res != null && res.status) { return res.data; } return null; } Future<dynamic> getOTA() async { var res = await NetManager.getInstance().baseUrl(otaBaseUrl).get(""); if (res != null && res.status) { return res.data; } return null; } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/net/response_interceptor.dart
import 'package:dio/dio.dart'; import 'package:flutter_dynamic_weather/app/utils/print_utils.dart'; import 'package:flutter_dynamic_weather/net/code.dart'; import 'package:flutter_dynamic_weather/net/rep_result.dart'; /// create by 张风捷特烈 on 2020/4/28 /// contact me by email [email protected] /// 说明: /// class ResponseInterceptors extends InterceptorsWrapper { @override onResponse(Response response) async { RequestOptions option = response.request; var value; try { var header = response.headers[Headers.contentTypeHeader]; if ((header != null && header.toString().contains("text"))) { value = new RepResult(response.data, true, Code.SUCCESS); } else if (response.statusCode >= 200 && response.statusCode < 300) { value = new RepResult(response.data, true, Code.SUCCESS); } } catch (e) { weatherPrint(e.toString() + option.path); value = new RepResult(response.data, false, response.statusCode,msg: e.toString()); } return value; } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/net/rep_result.dart
class RepResult { var data; bool status; int code; String msg; RepResult(this.data, this.status, this.code, {this.msg=""}); @override String toString() { return 'RepResult{data: $data, result: $status, code: $code, msg: $msg}'; } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/event/change_index_envent.dart
import 'package:flutter_dynamic_weather/model/city_model_entity.dart'; import 'package:flutter_dynamic_weather/views/pages/home/real_time_temp.dart'; import 'package:flutter_dynamic_weather/views/pages/search/search_page.dart'; class ChangeMainAppBarIndexEvent { final int index; final String cityFlag; ChangeMainAppBarIndexEvent(this.index, this.cityFlag); } class ChangeCityEvent { final String cityFlag; ChangeCityEvent(this.cityFlag); } class UpdateManagerData { } class MainBgChangeEvent {} class TtsStatusEvent { final TtsState ttsState; TtsStatusEvent(this.ttsState); }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/example/anim_view.dart
import 'package:flutter/material.dart'; import 'package:flutter_dynamic_weather/app/res/analytics_constant.dart'; import 'package:flutter_weather_bg/bg/weather_bg.dart'; import 'package:flutter_weather_bg/utils/weather_type.dart'; import 'package:umeng_analytics_plugin/umeng_analytics_plugin.dart'; /// 主要提供两个实例 /// 1. 切换天气类型时,会有过度动画 /// 2. 动态改变宽高,绘制的相关逻辑同步发生改变 class AnimViewWidget extends StatefulWidget { @override _AnimViewWidgetState createState() => _AnimViewWidgetState(); } class _AnimViewWidgetState extends State<AnimViewWidget> { WeatherType _weatherType = WeatherType.sunny; double _width = 100; double _height = 200; @override Widget build(BuildContext context) { var radius = 5 + (_width - 100) / 200 * 10; return Scaffold( appBar: AppBar( title: Text("AnimView"), actions: [ PopupMenuButton<WeatherType>( itemBuilder: (context) { return <PopupMenuEntry<WeatherType>>[ ...WeatherType.values .map((e) => PopupMenuItem<WeatherType>( value: e, child: Text("${WeatherUtil.getWeatherDesc(e)}"), )) .toList(), ]; }, initialValue: _weatherType, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("${WeatherUtil.getWeatherDesc(_weatherType)}"), Icon(Icons.more_vert) ], ), onSelected: (count) { UmengAnalyticsPlugin.event(AnalyticsConstant.aboutWeatherClick, label: "$count"); setState(() { _weatherType = count; }); }, ), ], ), body: Container( child: Column( mainAxisSize: MainAxisSize.min, children: [ Card( elevation: 7, margin: EdgeInsets.only(top: 15), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(radius)), child: ClipPath( clipper: ShapeBorderClipper( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(radius))), child: Container( child: WeatherBg( weatherType: _weatherType, width: _width, height: _height, ), ), ), ), SizedBox( height: 20, ), SizedBox( height: 20, ), Slider( min: 100, max: 300, label: "$_width", divisions: 200, onChanged: (value) { setState(() { _width = value; }); }, value: _width, ), SizedBox( height: 20, ), Slider( min: 200, max: 600, label: "$_height", divisions: 400, onChanged: (value) { setState(() { _height = value; }); }, value: _height, ) ], ), ), ); } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/example/grid_view.dart
import 'package:flutter/material.dart'; import 'package:flutter_dynamic_weather/app/res/analytics_constant.dart'; import 'package:flutter_weather_bg/flutter_weather_bg.dart'; import 'package:flutter_weather_bg/utils/print_utils.dart'; import 'package:umeng_analytics_plugin/umeng_analytics_plugin.dart'; /// 已宫格的形式展示多样的天气效果 /// 同时,支持切换列数 class GridViewWidget extends StatefulWidget { @override _GridViewWidgetState createState() => _GridViewWidgetState(); } class _GridViewWidgetState extends State<GridViewWidget> { int _count = 2; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("GridView"), actions: [ PopupMenuButton<int>( itemBuilder: (context) { return <PopupMenuEntry<int>>[ ...[ 1, 2, 3, 4, 5, ] .map((e) => PopupMenuItem<int>( value: e, child: Text("$e"), )) .toList(), ]; }, onSelected: (count) { UmengAnalyticsPlugin.event(AnalyticsConstant.exampleClick, label: "grid_click_$count"); setState(() { _count = count; }); }, ) ], ), body: Container( child: GridView.count( physics: BouncingScrollPhysics(), scrollDirection: Axis.vertical, crossAxisCount: _count, childAspectRatio: 1 / 2, children: WeatherType.values .map((e) => GridItemWidget( weatherType: e, count: _count, )) .toList(), ), )); } } class GridItemWidget extends StatelessWidget { final WeatherType weatherType; final int count; GridItemWidget({Key key, this.weatherType, this.count}) : super(key: key); @override Widget build(BuildContext context) { weatherPrint("grid item size: ${MediaQuery.of(context).size}"); var radius = 20.0 - 2 * count; var margin = 10.0 - count; return Card( elevation: 6, margin: EdgeInsets.all(margin), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius)), child: ClipPath( clipper: ShapeBorderClipper( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(radius))), child: Stack( children: [ WeatherBg( weatherType: weatherType, width: MediaQuery.of(context).size.width / count, height: MediaQuery.of(context).size.width * 2, ), Center( child: Text( WeatherUtil.getWeatherDesc(weatherType), style: TextStyle( color: Colors.white, fontSize: 30 / count, fontWeight: FontWeight.bold), ), ) ], ), ), ); } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/example/list_view.dart
import 'package:flutter/material.dart'; import 'package:flutter_weather_bg/bg/weather_bg.dart'; import 'package:flutter_weather_bg/utils/weather_type.dart'; class ListViewWidget extends StatefulWidget { @override _ListViewWidgetState createState() => _ListViewWidgetState(); } class _ListViewWidgetState extends State<ListViewWidget> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("listView"), ), body: ListView.separated( physics: BouncingScrollPhysics(), itemBuilder: (BuildContext context, int index) { return ListItemWidget( weatherType: WeatherType.values[index], ); }, separatorBuilder: (BuildContext context, int index) { return SizedBox( height: 5, ); }, itemCount: WeatherType.values.length, ), ); } } class ListItemWidget extends StatelessWidget { final WeatherType weatherType; ListItemWidget({Key key, this.weatherType}) : super(key: key); @override Widget build(BuildContext context) { return Card( elevation: 4, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), margin: EdgeInsets.symmetric(horizontal: 10, vertical: 8), child: ClipPath( child: Stack( children: [ WeatherBg( weatherType: weatherType, width: MediaQuery.of(context).size.width, height: 100, ), Container( alignment: Alignment(-0.8, 0), height: 100, child: Text( "北京", style: TextStyle( color: Colors.white, fontSize: 25, fontWeight: FontWeight.bold), ), ), Container( alignment: Alignment(0.8, 0), height: 100, child: Text( WeatherUtil.getWeatherDesc(weatherType), style: TextStyle( color: Colors.white, fontSize: 25, fontWeight: FontWeight.bold), ), ) ], ), clipper: ShapeBorderClipper( shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(20)))), ), ); } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/example/main.dart
import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_dynamic_weather/app/res/analytics_constant.dart'; import 'package:flutter_dynamic_weather/app/router.dart'; import 'package:flutter_dynamic_weather/example/anim_view.dart'; import 'package:flutter_dynamic_weather/example/grid_view.dart'; import 'package:flutter_dynamic_weather/example/list_view.dart'; import 'package:flutter_dynamic_weather/example/page_view.dart'; import 'package:flutter_weather_bg/bg/weather_bg.dart'; import 'package:flutter_weather_bg/flutter_weather_bg.dart'; import 'package:flutter_weather_bg/utils/print_utils.dart'; import 'package:umeng_analytics_plugin/umeng_analytics_plugin.dart'; class MyExampleApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyExampleApp> { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return HomePage(); } } /// demo 首页布局 class HomePage extends StatelessWidget { /// 创建首页 item 布局 Widget _buildItem(BuildContext context, String routeName, String desc, WeatherType weatherType) { double width = MediaQuery.of(context).size.width; double marginLeft = 10.0; double marginTop = 8.0; double itemWidth = (width - marginLeft * 4) / 2; double itemHeight = itemWidth * 1.5; var radius = 10.0; return Container( width: itemWidth, height: itemHeight, child: Card( elevation: 7, margin: EdgeInsets.only(left: marginLeft, right: marginLeft, top: marginTop, bottom: marginTop), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius)), child: ClipPath( clipper: ShapeBorderClipper( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(radius))), child: Stack( children: [ WeatherBg( weatherType: weatherType, width: itemWidth, height: itemHeight, ), BackdropFilter( filter: ImageFilter.blur(sigmaX: 2.5, sigmaY: 2.5), child: InkWell( child: Center( child: Text( desc, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20), ), ), onTap: () { weatherPrint("name: $routeName"); if (routeName == WeatherRouter.zhuge || routeName == WeatherRouter.jike) { WeatherRouter.jumpToNativePage(routeName); } else { Navigator.of(context).pushNamed(routeName); } UmengAnalyticsPlugin.event(AnalyticsConstant.exampleClick, label: routeName); }, ), ), ], ), ), ), ); } @override Widget build(BuildContext context) { return Scaffold( body: SingleChildScrollView( child: Wrap( children: [ SizedBox(width: 250, height: 50,), _buildItem( context, WeatherRouter.routePage, "翻页效果", WeatherType.thunder), _buildItem(context, WeatherRouter.routeGrid, "宫格效果", WeatherType.sunnyNight), _buildItem(context, WeatherRouter.routeList, "列表效果", WeatherType.lightSnow), _buildItem( context, WeatherRouter.routeAnim, "切换效果", WeatherType.sunny), _buildItem( context, WeatherRouter.zhuge, "诸葛天气", WeatherType.cloudyNight), _buildItem( context, WeatherRouter.jike, "即刻天气", WeatherType.lightRainy), ], ), ), ); } }
0
mirrored_repositories/SimplicityWeather/lib
mirrored_repositories/SimplicityWeather/lib/example/page_view.dart
import 'package:flutter/material.dart'; import 'package:flutter_weather_bg/flutter_weather_bg.dart'; import 'package:flutter_weather_bg/utils/print_utils.dart'; /// 普通的 ViewPager 展示样式 class PageViewWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Container( child: PageView.builder( physics: BouncingScrollPhysics(), itemBuilder: (BuildContext context, int index) { weatherPrint("pageView: ${MediaQuery.of(context).size}"); return Stack( children: [ WeatherBg( weatherType: WeatherType.values[index], width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, ), Center( child: Text( WeatherUtil.getWeatherDesc(WeatherType.values[index]), style: TextStyle( color: Colors.white, fontSize: 30, fontWeight: FontWeight.bold), ), ) ], ); }, itemCount: WeatherType.values.length, ), ), ); } }
0
mirrored_repositories/SimplicityWeather
mirrored_repositories/SimplicityWeather/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_dynamic_weather/views/app/flutter_app.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_dynamic_weather/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(FlutterApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Reviewify_Flutter_Review_App
mirrored_repositories/Reviewify_Flutter_Review_App/lib/quiz.dart
// imports the Flutter Material package, which provides widgets and tools for building // material design applications. import "package:flutter/material.dart"; // imports the Answer widget from a separate file named "answer.dart". import 'answer.dart'; // imports the Question widget from a separate file named "question.dart". import 'question.dart'; // Defining a Quiz class which extends the StatelessWidget class. This class has three // required arguments: answerQuestions, questionIndex, and questions, which are all of type // Function or List. The optional argument key is also passed to the superclass constructor. class Quiz extends StatelessWidget { // declares a final variable called answerQuestions which is a function that takes an // integer parameter and returns void. final void Function(int) answerQuestions; // a function that takes an int parameter and returns void // declares a final variable called questionIndex of type int, which represents the current // index of the question being displayed. final int questionIndex; // an int representing the current question index // declares a final variable called questions of type List<Map<String, Object>>, which // represents the list of questions and answers for the quiz. final List<Map<String, Object>> questions; // a list of maps, each map contains a question and its answers const Quiz(this.answerQuestions, this.questionIndex, this.questions, {Key? key}) : super(key: key); // Question is a custom widget which is being called with a string argument to display the // current question on the screen. @override Widget build(BuildContext context) { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Column( children: [ Question( questions[questionIndex]['questiontext'].toString(), ), ], ), // This section is using the spread operator ... to expand the contents of the List of answers // returned by .map() into the Column children. The .map() method applies the given function // to each item of the list. Here, it maps the List<Map<String, Object>> of answers to a List // of Answer widgets. Each Answer widget is given a callback function that takes an integer // argument, and the answer text to display on the button. Column( children: [ ...(questions[questionIndex]['answers'] as List<Map<String, Object>>) .map((answer) { return Answer( () => answerQuestions(answer['score'] as int), answer['text'].toString(), ); }).toList(), ], ), ], ); } } // Returning a Column widget with the Question widget and a list of Answer widgets as its // children. The build() method is required for all widgets in Flutter, and it must return // a widget.
0
mirrored_repositories/Reviewify_Flutter_Review_App
mirrored_repositories/Reviewify_Flutter_Review_App/lib/main_copy.dart
// This imports the Flutter Material package and two custom widgets named Question and Answer. // It also defines the main function which runs the MyApp widget. import 'package:flutter/material.dart'; import "./question.dart"; import "./answer.dart"; void main() => runApp(const MyApp()); // _ Convention of privating // This defines a stateful widget MyApp which has mutable state. // createState() method returns an instance of _MyAppState. class MyApp extends StatefulWidget { const MyApp({super.key}); @override State<StatefulWidget> createState() { return _MyAppState(); } } // This defines the state for MyApp which is private and can only be accessed within the class // _MyAppState. // questionIndex keeps track of the current question index. // answerQuestions is a method that increments the questionIndex state by 1 and calls setState() // method to update the UI. class _MyAppState extends State<MyApp> { var questionIndex = 0; void answerQuestions() { setState(() { questionIndex = questionIndex + 1; }); } // build method returns the UI of the widget. // questions is a list of maps, which stores questions and their respective answers. @override Widget build(BuildContext context) { const questions = [ { 'questiontext': "What 's your favourite places?", 'answers': ['Black', 'Red', 'Green', 'Blue'], }, { 'questiontext': "What 's your favourite animal?", 'answers': ['Lion', 'Cheetah', 'Shark', 'Panther'], }, { 'questiontext': "Who 's your favourite food?", 'answers': ['Continental', 'Pizza', 'Local', 'Burger'], } ]; // This is the main UI for the app. // MaterialApp is a wrapper widget for the entire app. // Scaffold is a widget for creating the basic material design visual layout structure. // AppBar is a widget for creating the top app bar. // Question widget displays the current question text by accessing it from the questions list. // The ... operator spreads the list of answers returned by the map function into separate widgets created using the Answer widget. // answerQuestions is passed as a callback function to the Answer widget which updates the state when an answer is selected. return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text("Travel App"), backgroundColor: const Color.fromARGB(255, 255, 37, 37)), body: Column(children: [ Question( questions[questionIndex % 3]['questiontext'].toString(), ), // Text(questions.elementAt(0)), // ElevatedButton( // onPressed: answerQuestions, // child: Text("Answer 1") // ), ...(questions[questionIndex % 3]['answers'] as List<String>) .map((answer) { return Answer(answerQuestions, answer); }).toList() // Answer(answerQuestions), // ElevatedButton( // onPressed: answerQuestions, // // onPressed: () => print("Answer 2 Choosen !"), // child: Text("Answer 2") // ), // Answer(answerQuestions), // ElevatedButton( // // onPressed: () { // // print("Answer 3 Choosen !"); // // }, // onPressed: answerQuestions, // child: Text("Answer 3") // ), // Answer(answerQuestions) ]), ), ); } }
0
mirrored_repositories/Reviewify_Flutter_Review_App
mirrored_repositories/Reviewify_Flutter_Review_App/lib/question.dart
import 'package:flutter/material.dart'; class Question extends StatelessWidget { final String questionText; const Question(this.questionText, {super.key}); @override Widget build(BuildContext context) { return Center( child: Container( width: double.infinity, margin: const EdgeInsets.all(10), child: Text( questionText, style: const TextStyle(fontSize: 20), textAlign: TextAlign.center, ), ), ); } }
0
mirrored_repositories/Reviewify_Flutter_Review_App
mirrored_repositories/Reviewify_Flutter_Review_App/lib/answer.dart
// Importing necessary packages. import 'package:flutter/material.dart'; // Defining an Answer class which extends the StatelessWidget class. This class has two // required arguments: selectHandler, a callback function to execute when the button is // pressed, and answertext, the text to display on the button. The optional argument key // is passed to the superclass constructor. class Answer extends StatelessWidget { final VoidCallback selectHandler; final String answertext; const Answer(this.selectHandler, this.answertext, {super.key}); // Defining the build() method to return a SizedBox with a width of double.infinity // (i.e., the button should be as wide as its parent container). The ElevatedButton widget // is used to create the button, and its onPressed argument is set to the selectHandler // callback function. The style argument is set to create a custom look for the button // using ElevatedButton.styleFrom(), which takes two arguments: foregroundColor and // backgroundColor. These arguments blend two colors to create a gradient effect for both // the text and the button background. Finally, the child argument is set to display the // answertext string in the button. @override Widget build(BuildContext context) { return FractionallySizedBox( widthFactor: 0.9, child: SizedBox( // width: double.infinity, // color: Colors.black87, child: ElevatedButton( onPressed: selectHandler, style: ElevatedButton.styleFrom( foregroundColor: Colors.white, backgroundColor: Colors.black.withOpacity(0.8), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(1000000000), ), padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 20), ), child: Text(answertext), ), ), ); } }
0
mirrored_repositories/Reviewify_Flutter_Review_App
mirrored_repositories/Reviewify_Flutter_Review_App/lib/result.dart
// This code defines a stateless widget called Result. It is used to display the result of // the quiz taken in the app. // Importing the material library from the Flutter framework. import 'package:flutter/material.dart'; // Declaring a new stateless widget called Result. class Result extends StatelessWidget { // Declaring two instance variables, resultscore and resetQuiz. resultscore holds the total // score obtained by the user in the quiz, and resetQuiz is a callback function to restart // the quiz. The const Result constructor takes these two variables as arguments. final int resultscore; final VoidCallback resetQuiz; const Result(this.resultscore, this.resetQuiz, {super.key}); // This build method returns the layout of the widget. It displays the result phrase calculated // by resultPhrase in a Text widget with a specified style. It also displays a TextButton widget // to restart the quiz when clicked. The layout is centered using the Center widget, and the // widgets are placed in a Column widget. @override Widget build(BuildContext context) { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ const Text( "Thank You For Your Response", style: TextStyle( fontSize: 36, fontWeight: FontWeight.bold, ), textAlign: TextAlign.center, ), ElevatedButton( onPressed: resetQuiz, style: ElevatedButton.styleFrom( foregroundColor: Colors.white, backgroundColor: Colors.black.withOpacity(0.8), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20), ), child: const Text("Reconsider Your Review"), ) ], ), ); } }
0
mirrored_repositories/Reviewify_Flutter_Review_App
mirrored_repositories/Reviewify_Flutter_Review_App/lib/main.dart
// This imports the necessary Flutter material library. import 'package:flutter/material.dart'; // These two lines import the quiz.dart and result.dart files from the current directory. import "./quiz.dart"; import "result.dart"; // This is the main entry point for the application, and it runs the MyApp widget. void main() => runApp(const MyApp()); // This is the MyApp widget, which extends StatefulWidget. It creates a new _MyAppState // object when the widget is built. class MyApp extends StatefulWidget { const MyApp({super.key}); @override State<StatefulWidget> createState() { return _MyAppState(); } } // This is the _MyAppState class, which extends State<MyApp>. It contains two instance // variables, questionIndex and total_score. class _MyAppState extends State<MyApp> { var questionIndex = 0; // ignore: non_constant_identifier_names int total_score = 0; // This is the build method, which creates the UI for the app. It defines a const list of // maps called questions, which contains the quiz questions and their respective answers. @override Widget build(BuildContext context) { const questions = [ { 'questiontext': "How would you rate the overall user experience of the app?", 'answers': [ {'text': 'Excellent', 'score': 10}, {'text': 'Good', 'score': 7}, {'text': 'Average', 'score': 4}, {'text': 'Poor', 'score': 1}, ] }, { 'questiontext': "How useful did you find the trip planning feature?", 'answers': [ {'text': 'Very useful', 'score': 10}, {'text': 'Somewhat useful', 'score': 7}, {'text': 'Not very useful', 'score': 4}, {'text': 'Not useful at all', 'score': 1} ] }, { 'questiontext': "How accurate and reliable were the real-time navigation instructions and live locations?", 'answers': [ {'text': 'Very accurate and reliable', 'score': 10}, {'text': 'Somewhat accurate and reliable', 'score': 7}, {'text': 'Not very accurate and reliable', 'score': 4}, {'text': 'Not accurate and reliable at all', 'score': 1} ] }, { 'questiontext': "Did you find the group chats and calls feature helpful for staying connected with other travelers?", 'answers': [ {'text': 'Extremely helpful', 'score': 10}, {'text': 'Moderately helpful', 'score': 7}, {'text': 'Slightly helpful', 'score': 4}, {'text': 'Not helpful at all', 'score': 1} ] }, { 'questiontext': "How effective was the translation service for translating signboards, menu cards, and speech?", 'answers': [ {'text': 'Very effective', 'score': 10}, {'text': 'Somewhat effective', 'score': 7}, {'text': 'Not very effective', 'score': 4}, {'text': 'Not effective at all', 'score': 1} ] }, { 'questiontext': "How easy was it to track expenses and settle bills among group members using the built-in expense tracker?", 'answers': [ {'text': 'Very easy', 'score': 10}, {'text': 'Somewhat easy', 'score': 7}, {'text': 'Not very easy', 'score': 4}, {'text': 'Not easy at all', 'score': 1} ] }, { 'questiontext': "Did the currency conversion feature help you manage your finances while traveling abroad?", 'answers': [ {'text': 'Yes, it was very helpful', 'score': 10}, {'text': 'It was somewhat helpful', 'score': 7}, {'text': 'Not very helpful', 'score': 4}, {'text': 'Not helpful at all', 'score': 1} ] }, { 'questiontext': "Were the personalized recommendations for accommodations, attractions, and restaurants based on your preferences useful?", 'answers': [ {'text': 'Extremely useful', 'score': 10}, {'text': 'Moderately useful', 'score': 7}, {'text': 'Slightly useful', 'score': 4}, {'text': 'Not useful at all', 'score': 1} ] }, { 'questiontext': "How well did the app perform in offline mode with limited connectivity?", 'answers': [ {'text': 'Worked perfectly offline', 'score': 10}, {'text': 'Worked somewhat well offline', 'score': 7}, {'text': 'Had limited functionality in offline mode', 'score': 4}, {'text': 'Did not work offline at all', 'score': 1} ] }, { 'questiontext': "How secure and user-friendly did you find the user authentication process?", 'answers': [ {'text': 'Very secure and user-friendly', 'score': 10}, {'text': 'Moderately secure and user-friendly', 'score': 7}, {'text': 'Not very secure and user-friendly', 'score': 4}, {'text': 'Not secure and user-friendly at all', 'score': 1} ] }, ]; // This is a function called resetQuiz, which resets the quiz by setting questionIndex and // total_score to 0. It calls the setState method to update the state of the app. void resetQuiz() { setState(() { questionIndex = 0; total_score = 0; }); } // This is a function called answerQuestions, which updates the total_score based on the // user's selected answer and increments the questionIndex to move to the next question. // It also checks if there are more questions to display or if the quiz has been completed. void answerQuestions(int score) { total_score += score; setState(() { questionIndex = questionIndex + 1; }); if (questionIndex < 2) { } else {} } return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text("TravelGenie"), backgroundColor: Colors.black, ), body: questionIndex < questions.length ? Quiz(answerQuestions, questionIndex, questions) : Result(total_score, resetQuiz), )); } }
0
mirrored_repositories/Reviewify_Flutter_Review_App
mirrored_repositories/Reviewify_Flutter_Review_App/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:basics/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/lib/home_screen.dart
import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:flutter/material.dart'; import 'model/homelist.dart'; class MyHomePage extends StatefulWidget { const MyHomePage({Key key}) : super(key: key); @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin { List<HomeList> homeList = HomeList.homeList; AnimationController animationController; bool multiple = true; @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 2000), vsync: this); super.initState(); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 0)); return true; } @override void dispose() { animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppTheme.white, body: FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return Padding( padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ appBar(), Expanded( child: FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return GridView( padding: const EdgeInsets.only( top: 0, left: 12, right: 12), physics: const BouncingScrollPhysics(), scrollDirection: Axis.vertical, children: List<Widget>.generate( homeList.length, (int index) { final int count = homeList.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval((1 / count) * index, 1.0, curve: Curves.fastOutSlowIn), ), ); animationController.forward(); return HomeListView( animation: animation, animationController: animationController, listData: homeList[index], callBack: () { Navigator.push<dynamic>( context, MaterialPageRoute<dynamic>( builder: (BuildContext context) => homeList[index].navigateScreen, ), ); }, ); }, ), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: multiple ? 2 : 1, mainAxisSpacing: 12.0, crossAxisSpacing: 12.0, childAspectRatio: 1.5, ), ); } }, ), ), ], ), ); } }, ), ); } Widget appBar() { return SizedBox( height: AppBar().preferredSize.height, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 8, left: 8), child: Container( width: AppBar().preferredSize.height - 8, height: AppBar().preferredSize.height - 8, ), ), Expanded( child: Center( child: Padding( padding: const EdgeInsets.only(top: 4), child: Text( 'Flutter UI', style: TextStyle( fontSize: 22, color: AppTheme.darkText, fontWeight: FontWeight.w700, ), ), ), ), ), Padding( padding: const EdgeInsets.only(top: 8, right: 8), child: Container( width: AppBar().preferredSize.height - 8, height: AppBar().preferredSize.height - 8, color: Colors.white, child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(AppBar().preferredSize.height), child: Icon( multiple ? Icons.dashboard : Icons.view_agenda, color: AppTheme.dark_grey, ), onTap: () { setState(() { multiple = !multiple; }); }, ), ), ), ), ], ), ); } } class HomeListView extends StatelessWidget { const HomeListView( {Key key, this.listData, this.callBack, this.animationController, this.animation}) : super(key: key); final HomeList listData; final VoidCallback callBack; final AnimationController animationController; final Animation<dynamic> animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: Transform( transform: Matrix4.translationValues( 0.0, 50 * (1.0 - animation.value), 0.0), child: AspectRatio( aspectRatio: 1.5, child: ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(4.0)), child: Stack( alignment: AlignmentDirectional.center, children: <Widget>[ Image.asset( listData.imagePath, fit: BoxFit.cover, ), Material( color: Colors.transparent, child: InkWell( splashColor: Colors.grey.withOpacity(0.2), borderRadius: const BorderRadius.all(Radius.circular(4.0)), onTap: () { callBack(); }, ), ), ], ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/lib/app_theme.dart
import 'package:flutter/material.dart'; class AppTheme { AppTheme._(); static const Color notWhite = Color(0xFFEDF0F2); static const Color nearlyWhite = Color(0xFFFEFEFE); static const Color white = Color(0xFFFFFFFF); static const Color nearlyBlack = Color(0xFF213333); static const Color grey = Color(0xFF3A5160); static const Color dark_grey = Color(0xFF313A44); static const Color darkText = Color(0xFF253840); static const Color darkerText = Color(0xFF17262A); static const Color lightText = Color(0xFF4A6572); static const Color deactivatedText = Color(0xFF767676); static const Color dismissibleBackground = Color(0xFF364A54); static const Color chipBackground = Color(0xFFEEF1F3); static const Color spacer = Color(0xFFF2F2F2); static const String fontName = 'WorkSans'; static const TextTheme textTheme = TextTheme( headline4: display1, headline5: headline, headline6: title, subtitle2: subtitle, bodyText2: body2, bodyText1: body1, caption: caption, ); static const TextStyle display1 = TextStyle( // h4 -> display1 fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 36, letterSpacing: 0.4, height: 0.9, color: darkerText, ); static const TextStyle headline = TextStyle( // h5 -> headline fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 24, letterSpacing: 0.27, color: darkerText, ); static const TextStyle title = TextStyle( // h6 -> title fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 16, letterSpacing: 0.18, color: darkerText, ); static const TextStyle subtitle = TextStyle( // subtitle2 -> subtitle fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 14, letterSpacing: -0.04, color: darkText, ); static const TextStyle body2 = TextStyle( // body1 -> body2 fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 14, letterSpacing: 0.2, color: darkText, ); static const TextStyle body1 = TextStyle( // body2 -> body1 fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 16, letterSpacing: -0.05, color: darkText, ); static const TextStyle caption = TextStyle( // Caption -> caption fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 12, letterSpacing: 0.2, color: lightText, // was lightText ); }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/lib/feedback_screen.dart
import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:flutter/material.dart'; class FeedbackScreen extends StatefulWidget { @override _FeedbackScreenState createState() => _FeedbackScreenState(); } class _FeedbackScreenState extends State<FeedbackScreen> { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Container( color: AppTheme.nearlyWhite, child: SafeArea( top: false, child: Scaffold( backgroundColor: AppTheme.nearlyWhite, body: SingleChildScrollView( child: SizedBox( height: MediaQuery.of(context).size.height, child: Column( children: <Widget>[ Container( padding: EdgeInsets.only( top: MediaQuery.of(context).padding.top, left: 16, right: 16), child: Image.asset('assets/images/feedbackImage.png'), ), Container( padding: const EdgeInsets.only(top: 8), child: Text( 'Your FeedBack', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), ), Container( padding: const EdgeInsets.only(top: 16), child: const Text( 'Give your best time for this moment.', textAlign: TextAlign.center, style: TextStyle( fontSize: 16, ), ), ), _buildComposer(), Padding( padding: const EdgeInsets.only(top: 16), child: Center( child: Container( width: 120, height: 40, decoration: BoxDecoration( color: Colors.blue, borderRadius: const BorderRadius.all(Radius.circular(4.0)), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.6), offset: const Offset(4, 4), blurRadius: 8.0), ], ), child: Material( color: Colors.transparent, child: InkWell( onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child: Center( child: Padding( padding: const EdgeInsets.all(4.0), child: Text( 'Send', style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, ), ), ), ), ), ), ), ), ) ], ), ), ), ), ), ); } Widget _buildComposer() { return Padding( padding: const EdgeInsets.only(top: 16, left: 32, right: 32), child: Container( decoration: BoxDecoration( color: AppTheme.white, borderRadius: BorderRadius.circular(8), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.8), offset: const Offset(4, 4), blurRadius: 8), ], ), child: ClipRRect( borderRadius: BorderRadius.circular(25), child: Container( padding: const EdgeInsets.all(4.0), constraints: const BoxConstraints(minHeight: 80, maxHeight: 160), color: AppTheme.white, child: SingleChildScrollView( padding: const EdgeInsets.only(left: 10, right: 10, top: 0, bottom: 0), child: TextField( maxLines: null, onChanged: (String txt) {}, style: TextStyle( fontFamily: AppTheme.fontName, fontSize: 16, color: AppTheme.dark_grey, ), cursorColor: Colors.blue, decoration: InputDecoration( border: InputBorder.none, hintText: 'Enter your feedback...'), ), ), ), ), ), ); } }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/lib/help_screen.dart
import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:flutter/material.dart'; class HelpScreen extends StatefulWidget { @override _HelpScreenState createState() => _HelpScreenState(); } class _HelpScreenState extends State<HelpScreen> { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Container( color: AppTheme.nearlyWhite, child: SafeArea( top: false, child: Scaffold( backgroundColor: AppTheme.nearlyWhite, body: Column( children: <Widget>[ Container( padding: EdgeInsets.only( top: MediaQuery.of(context).padding.top, left: 16, right: 16), child: Image.asset('assets/images/helpImage.png'), ), Container( padding: const EdgeInsets.only(top: 8), child: Text( 'How can we help you?', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), ), Container( padding: const EdgeInsets.only(top: 16), child: const Text( 'It looks like you are experiencing problems\nwith our sign up process. We are here to\nhelp so please get in touch with us', textAlign: TextAlign.center, style: TextStyle( fontSize: 16, ), ), ), Expanded( child: Padding( padding: const EdgeInsets.all(8.0), child: Center( child: Container( width: 140, height: 40, decoration: BoxDecoration( color: Colors.blue, borderRadius: const BorderRadius.all(Radius.circular(4.0)), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.6), offset: const Offset(4, 4), blurRadius: 8.0), ], ), child: Material( color: Colors.transparent, child: InkWell( onTap: () {}, child: Center( child: Padding( padding: const EdgeInsets.all(4.0), child: Text( 'Chat with Us', style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, ), ), ), ), ), ), ), ), ), ) ], ), ), ), ); } }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/lib/invite_friend_screen.dart
import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:flutter/material.dart'; class InviteFriend extends StatefulWidget { @override _InviteFriendState createState() => _InviteFriendState(); } class _InviteFriendState extends State<InviteFriend> { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Container( color: AppTheme.nearlyWhite, child: SafeArea( top: false, child: Scaffold( backgroundColor: AppTheme.nearlyWhite, body: Column( children: <Widget>[ Container( padding: EdgeInsets.only( top: MediaQuery.of(context).padding.top, left: 16, right: 16), child: Image.asset('assets/images/inviteImage.png'), ), Container( padding: const EdgeInsets.only(top: 8), child: Text( 'Invite Your Friends', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), ), Container( padding: const EdgeInsets.only(top: 16), child: const Text( 'Are you one of those who makes everything\n at the last moment?', textAlign: TextAlign.center, style: TextStyle( fontSize: 16, ), ), ), Expanded( child: Padding( padding: const EdgeInsets.all(8.0), child: Center( child: Container( width: 120, height: 40, decoration: BoxDecoration( color: Colors.blue, borderRadius: const BorderRadius.all(Radius.circular(4.0)), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.6), offset: const Offset(4, 4), blurRadius: 8.0), ], ), child: Material( color: Colors.transparent, child: InkWell( onTap: () {}, child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Icon( Icons.share, color: Colors.white, size: 22, ), Padding( padding: const EdgeInsets.all(4.0), child: Text( 'Share', style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, ), ), ), ], ), ), ), ), ), ), ), ) ], ), ), ), ); } }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/lib/main.dart
import 'dart:io'; import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'navigation_home_screen.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await SystemChrome.setPreferredOrientations(<DeviceOrientation>[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]) .then((_) => runApp(MyApp())); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Colors.transparent, statusBarIconBrightness: Brightness.dark, statusBarBrightness: Platform.isAndroid ? Brightness.dark : Brightness.light, systemNavigationBarColor: Colors.white, systemNavigationBarDividerColor: Colors.grey, systemNavigationBarIconBrightness: Brightness.dark, )); return MaterialApp( title: 'Flutter UI', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, textTheme: AppTheme.textTheme, platform: TargetPlatform.iOS, ), home: NavigationHomeScreen(), ); } } class HexColor extends Color { HexColor(final String hexColor) : super(_getColorFromHex(hexColor)); static int _getColorFromHex(String hexColor) { hexColor = hexColor.toUpperCase().replaceAll('#', ''); if (hexColor.length == 6) { hexColor = 'FF' + hexColor; } return int.parse(hexColor, radix: 16); } }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/lib/navigation_home_screen.dart
import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:best_flutter_ui_templates/custom_drawer/drawer_user_controller.dart'; import 'package:best_flutter_ui_templates/custom_drawer/home_drawer.dart'; import 'package:best_flutter_ui_templates/feedback_screen.dart'; import 'package:best_flutter_ui_templates/help_screen.dart'; import 'package:best_flutter_ui_templates/home_screen.dart'; import 'package:best_flutter_ui_templates/invite_friend_screen.dart'; import 'package:flutter/material.dart'; class NavigationHomeScreen extends StatefulWidget { @override _NavigationHomeScreenState createState() => _NavigationHomeScreenState(); } class _NavigationHomeScreenState extends State<NavigationHomeScreen> { Widget screenView; DrawerIndex drawerIndex; @override void initState() { drawerIndex = DrawerIndex.HOME; screenView = const MyHomePage(); super.initState(); } @override Widget build(BuildContext context) { return Container( color: AppTheme.nearlyWhite, child: SafeArea( top: false, bottom: false, child: Scaffold( backgroundColor: AppTheme.nearlyWhite, body: DrawerUserController( screenIndex: drawerIndex, drawerWidth: MediaQuery.of(context).size.width * 0.75, onDrawerCall: (DrawerIndex drawerIndexdata) { changeIndex(drawerIndexdata); //callback from drawer for replace screen as user need with passing DrawerIndex(Enum index) }, screenView: screenView, //we replace screen view as we need on navigate starting screens like MyHomePage, HelpScreen, FeedbackScreen, etc... ), ), ), ); } void changeIndex(DrawerIndex drawerIndexdata) { if (drawerIndex != drawerIndexdata) { drawerIndex = drawerIndexdata; if (drawerIndex == DrawerIndex.HOME) { setState(() { screenView = const MyHomePage(); }); } else if (drawerIndex == DrawerIndex.Help) { setState(() { screenView = HelpScreen(); }); } else if (drawerIndex == DrawerIndex.FeedBack) { setState(() { screenView = FeedbackScreen(); }); } else if (drawerIndex == DrawerIndex.Invite) { setState(() { screenView = InviteFriend(); }); } else { //do in your way...... } } } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/model/homelist.dart
import 'package:best_flutter_ui_templates/design_course/home_design_course.dart'; import 'package:best_flutter_ui_templates/fitness_app/fitness_app_home_screen.dart'; import 'package:best_flutter_ui_templates/hotel_booking/hotel_home_screen.dart'; import 'package:flutter/widgets.dart'; class HomeList { HomeList({ this.navigateScreen, this.imagePath = '', }); Widget navigateScreen; String imagePath; static List<HomeList> homeList = [ HomeList( imagePath: 'assets/hotel/hotel_booking.png', navigateScreen: HotelHomeScreen(), ), HomeList( imagePath: 'assets/fitness_app/fitness_app.png', navigateScreen: FitnessAppHomeScreen(), ), HomeList( imagePath: 'assets/design_course/design_course.png', navigateScreen: DesignCourseHomeScreen(), ), ]; }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/calendar_popup_view.dart
import 'dart:ui'; import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'custom_calendar.dart'; class CalendarPopupView extends StatefulWidget { const CalendarPopupView( {Key key, this.initialStartDate, this.initialEndDate, this.onApplyClick, this.onCancelClick, this.barrierDismissible = true, this.minimumDate, this.maximumDate}) : super(key: key); final DateTime minimumDate; final DateTime maximumDate; final bool barrierDismissible; final DateTime initialStartDate; final DateTime initialEndDate; final Function(DateTime, DateTime) onApplyClick; final Function onCancelClick; @override _CalendarPopupViewState createState() => _CalendarPopupViewState(); } class _CalendarPopupViewState extends State<CalendarPopupView> with TickerProviderStateMixin { AnimationController animationController; DateTime startDate; DateTime endDate; @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 400), vsync: this); if (widget.initialStartDate != null) { startDate = widget.initialStartDate; } if (widget.initialEndDate != null) { endDate = widget.initialEndDate; } animationController.forward(); super.initState(); } @override void dispose() { animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Center( child: Scaffold( backgroundColor: Colors.transparent, body: AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return AnimatedOpacity( duration: const Duration(milliseconds: 100), opacity: animationController.value, child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, onTap: () { if (widget.barrierDismissible) { Navigator.pop(context); } }, child: Center( child: Padding( padding: const EdgeInsets.all(24.0), child: Container( decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().backgroundColor, borderRadius: const BorderRadius.all(Radius.circular(24.0)), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.2), offset: const Offset(4, 4), blurRadius: 8.0), ], ), child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(24.0)), onTap: () {}, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: <Widget>[ Row( children: <Widget>[ Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( 'From', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, color: Colors.grey.withOpacity(0.8)), ), const SizedBox( height: 4, ), Text( startDate != null ? DateFormat('EEE, dd MMM') .format(startDate) : '--/-- ', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16, ), ), ], ), ), Container( height: 74, width: 1, color: HotelAppTheme.buildLightTheme() .dividerColor, ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( 'To', style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, color: Colors.grey.withOpacity(0.8)), ), const SizedBox( height: 4, ), Text( endDate != null ? DateFormat('EEE, dd MMM') .format(endDate) : '--/-- ', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16), ), ], ), ) ], ), const Divider( height: 1, ), CustomCalendarView( minimumDate: widget.minimumDate, maximumDate: widget.maximumDate, initialEndDate: widget.initialEndDate, initialStartDate: widget.initialStartDate, startEndDateChange: (DateTime startDateData, DateTime endDateData) { setState(() { startDate = startDateData; endDate = endDateData; }); }, ), Padding( padding: const EdgeInsets.only( left: 16, right: 16, bottom: 16, top: 8), child: Container( height: 48, decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme() .primaryColor, borderRadius: const BorderRadius.all( Radius.circular(24.0)), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.6), blurRadius: 8, offset: const Offset(4, 4), ), ], ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all( Radius.circular(24.0)), highlightColor: Colors.transparent, onTap: () { try { // animationController.reverse().then((f) { // }); widget.onApplyClick(startDate, endDate); Navigator.pop(context); } catch (_) {} }, child: Center( child: Text( 'Apply', style: TextStyle( fontWeight: FontWeight.w500, fontSize: 18, color: Colors.white), ), ), ), ), ), ) ], ), ), ), ), ), ), ); }, ), ), ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/hotel_home_screen.dart
import 'dart:ui'; import 'package:best_flutter_ui_templates/hotel_booking/calendar_popup_view.dart'; import 'package:best_flutter_ui_templates/hotel_booking/hotel_list_view.dart'; import 'package:best_flutter_ui_templates/hotel_booking/model/hotel_list_data.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; import 'filters_screen.dart'; import 'hotel_app_theme.dart'; class HotelHomeScreen extends StatefulWidget { @override _HotelHomeScreenState createState() => _HotelHomeScreenState(); } class _HotelHomeScreenState extends State<HotelHomeScreen> with TickerProviderStateMixin { AnimationController animationController; List<HotelListData> hotelList = HotelListData.hotelList; final ScrollController _scrollController = ScrollController(); DateTime startDate = DateTime.now(); DateTime endDate = DateTime.now().add(const Duration(days: 5)); @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 1000), vsync: this); super.initState(); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 200)); return true; } @override void dispose() { animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Theme( data: HotelAppTheme.buildLightTheme(), child: Container( child: Scaffold( body: Stack( children: <Widget>[ InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child: Column( children: <Widget>[ getAppBarUI(), Expanded( child: NestedScrollView( controller: _scrollController, headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return <Widget>[ SliverList( delegate: SliverChildBuilderDelegate( (BuildContext context, int index) { return Column( children: <Widget>[ getSearchBarUI(), getTimeDateUI(), ], ); }, childCount: 1), ), SliverPersistentHeader( pinned: true, floating: true, delegate: ContestTabHeader( getFilterBarUI(), ), ), ]; }, body: Container( color: HotelAppTheme.buildLightTheme().backgroundColor, child: ListView.builder( itemCount: hotelList.length, padding: const EdgeInsets.only(top: 8), scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) { final int count = hotelList.length > 10 ? 10 : hotelList.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval( (1 / count) * index, 1.0, curve: Curves.fastOutSlowIn))); animationController.forward(); return HotelListView( callback: () {}, hotelData: hotelList[index], animation: animation, animationController: animationController, ); }, ), ), ), ) ], ), ), ], ), ), ), ); } Widget getListUI() { return Container( decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().backgroundColor, boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.2), offset: const Offset(0, -2), blurRadius: 8.0), ], ), child: Column( children: <Widget>[ Container( height: MediaQuery.of(context).size.height - 156 - 50, child: FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return ListView.builder( itemCount: hotelList.length, scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) { final int count = hotelList.length > 10 ? 10 : hotelList.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval((1 / count) * index, 1.0, curve: Curves.fastOutSlowIn))); animationController.forward(); return HotelListView( callback: () {}, hotelData: hotelList[index], animation: animation, animationController: animationController, ); }, ); } }, ), ) ], ), ); } Widget getHotelViewList() { final List<Widget> hotelListViews = <Widget>[]; for (int i = 0; i < hotelList.length; i++) { final int count = hotelList.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval((1 / count) * i, 1.0, curve: Curves.fastOutSlowIn), ), ); hotelListViews.add( HotelListView( callback: () {}, hotelData: hotelList[i], animation: animation, animationController: animationController, ), ); } animationController.forward(); return Column( children: hotelListViews, ); } Widget getTimeDateUI() { return Padding( padding: const EdgeInsets.only(left: 18, bottom: 16), child: Row( children: <Widget>[ Expanded( child: Row( children: <Widget>[ Material( color: Colors.transparent, child: InkWell( focusColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, splashColor: Colors.grey.withOpacity(0.2), borderRadius: const BorderRadius.all( Radius.circular(4.0), ), onTap: () { FocusScope.of(context).requestFocus(FocusNode()); // setState(() { // isDatePopupOpen = true; // }); showDemoDialog(context: context); }, child: Padding( padding: const EdgeInsets.only( left: 8, right: 8, top: 4, bottom: 4), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Choose date', style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, color: Colors.grey.withOpacity(0.8)), ), const SizedBox( height: 8, ), Text( '${DateFormat("dd, MMM").format(startDate)} - ${DateFormat("dd, MMM").format(endDate)}', style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, ), ), ], ), ), ), ), ], ), ), Padding( padding: const EdgeInsets.only(right: 8), child: Container( width: 1, height: 42, color: Colors.grey.withOpacity(0.8), ), ), Expanded( child: Row( children: <Widget>[ Material( color: Colors.transparent, child: InkWell( focusColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, splashColor: Colors.grey.withOpacity(0.2), borderRadius: const BorderRadius.all( Radius.circular(4.0), ), onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child: Padding( padding: const EdgeInsets.only( left: 8, right: 8, top: 4, bottom: 4), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Number of Rooms', style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, color: Colors.grey.withOpacity(0.8)), ), const SizedBox( height: 8, ), Text( '1 Room - 2 Adults', style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, ), ), ], ), ), ), ), ], ), ), ], ), ); } Widget getSearchBarUI() { return Padding( padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8), child: Row( children: <Widget>[ Expanded( child: Padding( padding: const EdgeInsets.only(right: 16, top: 8, bottom: 8), child: Container( decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().backgroundColor, borderRadius: const BorderRadius.all( Radius.circular(38.0), ), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.2), offset: const Offset(0, 2), blurRadius: 8.0), ], ), child: Padding( padding: const EdgeInsets.only( left: 16, right: 16, top: 4, bottom: 4), child: TextField( onChanged: (String txt) {}, style: const TextStyle( fontSize: 18, ), cursorColor: HotelAppTheme.buildLightTheme().primaryColor, decoration: InputDecoration( border: InputBorder.none, hintText: 'London...', ), ), ), ), ), ), Container( decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().primaryColor, borderRadius: const BorderRadius.all( Radius.circular(38.0), ), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.4), offset: const Offset(0, 2), blurRadius: 8.0), ], ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child: Padding( padding: const EdgeInsets.all(16.0), child: Icon(FontAwesomeIcons.search, size: 20, color: HotelAppTheme.buildLightTheme().backgroundColor), ), ), ), ), ], ), ); } Widget getFilterBarUI() { return Stack( children: <Widget>[ Positioned( top: 0, left: 0, right: 0, child: Container( height: 24, decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().backgroundColor, boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.2), offset: const Offset(0, -2), blurRadius: 8.0), ], ), ), ), Container( color: HotelAppTheme.buildLightTheme().backgroundColor, child: Padding( padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 4), child: Row( children: <Widget>[ Expanded( child: Padding( padding: const EdgeInsets.all(8.0), child: Text( '530 hotels found', style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, ), ), ), ), Material( color: Colors.transparent, child: InkWell( focusColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, splashColor: Colors.grey.withOpacity(0.2), borderRadius: const BorderRadius.all( Radius.circular(4.0), ), onTap: () { FocusScope.of(context).requestFocus(FocusNode()); Navigator.push<dynamic>( context, MaterialPageRoute<dynamic>( builder: (BuildContext context) => FiltersScreen(), fullscreenDialog: true), ); }, child: Padding( padding: const EdgeInsets.only(left: 8), child: Row( children: <Widget>[ Text( 'Filter', style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, ), ), Padding( padding: const EdgeInsets.all(8.0), child: Icon(Icons.sort, color: HotelAppTheme.buildLightTheme() .primaryColor), ), ], ), ), ), ), ], ), ), ), const Positioned( top: 0, left: 0, right: 0, child: Divider( height: 1, ), ) ], ); } void showDemoDialog({BuildContext context}) { showDialog<dynamic>( context: context, builder: (BuildContext context) => CalendarPopupView( barrierDismissible: true, minimumDate: DateTime.now(), // maximumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 10), initialEndDate: endDate, initialStartDate: startDate, onApplyClick: (DateTime startData, DateTime endData) { setState(() { if (startData != null && endData != null) { startDate = startData; endDate = endData; } }); }, onCancelClick: () {}, ), ); } Widget getAppBarUI() { return Container( decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().backgroundColor, boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.2), offset: const Offset(0, 2), blurRadius: 8.0), ], ), child: Padding( padding: EdgeInsets.only( top: MediaQuery.of(context).padding.top, left: 8, right: 8), child: Row( children: <Widget>[ Container( alignment: Alignment.centerLeft, width: AppBar().preferredSize.height + 40, height: AppBar().preferredSize.height, child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () { Navigator.pop(context); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Icon(Icons.arrow_back), ), ), ), ), Expanded( child: Center( child: Text( 'Explore', style: TextStyle( fontWeight: FontWeight.w600, fontSize: 22, ), ), ), ), Container( width: AppBar().preferredSize.height + 40, height: AppBar().preferredSize.height, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () {}, child: Padding( padding: const EdgeInsets.all(8.0), child: Icon(Icons.favorite_border), ), ), ), Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () {}, child: Padding( padding: const EdgeInsets.all(8.0), child: Icon(FontAwesomeIcons.mapMarkerAlt), ), ), ), ], ), ) ], ), ), ); } } class ContestTabHeader extends SliverPersistentHeaderDelegate { ContestTabHeader( this.searchUI, ); final Widget searchUI; @override Widget build( BuildContext context, double shrinkOffset, bool overlapsContent) { return searchUI; } @override double get maxExtent => 52.0; @override double get minExtent => 52.0; @override bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) { return false; } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/range_slider_view.dart
import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; import 'package:flutter/material.dart'; class RangeSliderView extends StatefulWidget { const RangeSliderView({Key key, this.values, this.onChangeRangeValues}) : super(key: key); final Function(RangeValues) onChangeRangeValues; final RangeValues values; @override _RangeSliderViewState createState() => _RangeSliderViewState(); } class _RangeSliderViewState extends State<RangeSliderView> { RangeValues _values; @override void initState() { _values = widget.values; super.initState(); } @override Widget build(BuildContext context) { return Container( child: Column( children: <Widget>[ Stack( children: <Widget>[ Row( children: <Widget>[ Expanded( flex: _values.start.round(), child: const SizedBox(), ), Container( width: 54, child: Text( '\$${_values.start.round()}', textAlign: TextAlign.center, ), ), Expanded( flex: 1000 - _values.start.round(), child: const SizedBox(), ), ], ), Row( children: <Widget>[ Expanded( flex: _values.end.round(), child: const SizedBox(), ), Container( width: 54, child: Text( '\$${_values.end.round()}', textAlign: TextAlign.center, ), ), Expanded( flex: 1000 - _values.end.round(), child: const SizedBox(), ), ], ), ], ), SliderTheme( data: SliderThemeData( rangeThumbShape: CustomRangeThumbShape(), ), child: RangeSlider( values: _values, min: 0.0, max: 1000.0, activeColor: HotelAppTheme.buildLightTheme().primaryColor, inactiveColor: Colors.grey.withOpacity(0.4), divisions: 1000, onChanged: (RangeValues values) { try { setState(() { _values = values; }); widget.onChangeRangeValues(_values); } catch (_) {} }, ), ), ], ), ); } } class CustomRangeThumbShape extends RangeSliderThumbShape { static const double _thumbSize = 3.0; static const double _disabledThumbSize = 3.0; @override Size getPreferredSize(bool isEnabled, bool isDiscrete) { return isEnabled ? const Size.fromRadius(_thumbSize) : const Size.fromRadius(_disabledThumbSize); } static final Animatable<double> sizeTween = Tween<double>( begin: _disabledThumbSize, end: _thumbSize, ); @override void paint( PaintingContext context, Offset center, { @required Animation<double> activationAnimation, @required Animation<double> enableAnimation, bool isDiscrete = false, bool isEnabled = false, bool isOnTop, bool isPressed, @required SliderThemeData sliderTheme, TextDirection textDirection, Thumb thumb, }) { final Canvas canvas = context.canvas; final ColorTween colorTween = ColorTween( begin: sliderTheme.disabledThumbColor, end: sliderTheme.thumbColor, ); final double size = _thumbSize * sizeTween.evaluate(enableAnimation); Path thumbPath; switch (textDirection) { case TextDirection.rtl: switch (thumb) { case Thumb.start: thumbPath = _rightTriangle(size, center); break; case Thumb.end: thumbPath = _leftTriangle(size, center); break; } break; case TextDirection.ltr: switch (thumb) { case Thumb.start: thumbPath = _leftTriangle(size, center); break; case Thumb.end: thumbPath = _rightTriangle(size, center); break; } break; } canvas.drawPath( Path() ..addOval(Rect.fromPoints(Offset(center.dx + 12, center.dy + 12), Offset(center.dx - 12, center.dy - 12))) ..fillType = PathFillType.evenOdd, Paint() ..color = Colors.black.withOpacity(0.5) ..maskFilter = MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(8))); final Paint cPaint = Paint(); cPaint..color = Colors.white; cPaint..strokeWidth = 14 / 2; canvas.drawCircle(Offset(center.dx, center.dy), 12, cPaint); cPaint..color = colorTween.evaluate(enableAnimation); canvas.drawCircle(Offset(center.dx, center.dy), 10, cPaint); canvas.drawPath(thumbPath, Paint()..color = Colors.white); } double convertRadiusToSigma(double radius) { return radius * 0.57735 + 0.5; } Path _rightTriangle(double size, Offset thumbCenter, {bool invert = false}) { final Path thumbPath = Path(); final double sign = invert ? -1.0 : 1.0; thumbPath.moveTo(thumbCenter.dx + 5 * sign, thumbCenter.dy); thumbPath.lineTo(thumbCenter.dx - 3 * sign, thumbCenter.dy - 5); thumbPath.lineTo(thumbCenter.dx - 3 * sign, thumbCenter.dy + 5); thumbPath.close(); return thumbPath; } Path _leftTriangle(double size, Offset thumbCenter) => _rightTriangle(size, thumbCenter, invert: true); }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/slider_view.dart
import 'package:flutter/material.dart'; import 'hotel_app_theme.dart'; class SliderView extends StatefulWidget { const SliderView({Key key, this.onChangedistValue, this.distValue}) : super(key: key); final Function(double) onChangedistValue; final double distValue; @override _SliderViewState createState() => _SliderViewState(); } class _SliderViewState extends State<SliderView> { double distValue = 50.0; @override void initState() { distValue = widget.distValue; super.initState(); } @override Widget build(BuildContext context) { return Container( child: Column( children: <Widget>[ Row( children: <Widget>[ Expanded( flex: distValue.round(), child: const SizedBox(), ), Container( width: 170, child: Text( 'Less than ${(distValue / 10).toStringAsFixed(1)} Km', textAlign: TextAlign.center, ), ), Expanded( flex: 100 - distValue.round(), child: const SizedBox(), ), ], ), SliderTheme( data: SliderThemeData( thumbShape: CustomThumbShape(), ), child: Slider( onChanged: (double value) { setState(() { distValue = value; }); try { widget.onChangedistValue(distValue); } catch (_) {} }, min: 0, max: 100, activeColor: HotelAppTheme.buildLightTheme().primaryColor, inactiveColor: Colors.grey.withOpacity(0.4), divisions: 100, value: distValue, ), ), ], ), ); } } class CustomThumbShape extends SliderComponentShape { static const double _thumbSize = 3.0; static const double _disabledThumbSize = 3.0; @override Size getPreferredSize(bool isEnabled, bool isDiscrete) { return isEnabled ? const Size.fromRadius(_thumbSize) : const Size.fromRadius(_disabledThumbSize); } static final Animatable<double> sizeTween = Tween<double>( begin: _disabledThumbSize, end: _thumbSize, ); @override void paint( PaintingContext context, Offset thumbCenter, { Animation<double> activationAnimation, Animation<double> enableAnimation, bool isDiscrete, TextPainter labelPainter, RenderBox parentBox, Size sizeWithOverflow, SliderThemeData sliderTheme, TextDirection textDirection, double textScaleFactor, double value, }) { final Canvas canvas = context.canvas; final ColorTween colorTween = ColorTween( begin: sliderTheme.disabledThumbColor, end: sliderTheme.thumbColor, ); canvas.drawPath( Path() ..addOval(Rect.fromPoints( Offset(thumbCenter.dx + 12, thumbCenter.dy + 12), Offset(thumbCenter.dx - 12, thumbCenter.dy - 12))) ..fillType = PathFillType.evenOdd, Paint() ..color = Colors.black.withOpacity(0.5) ..maskFilter = MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(8))); final Paint cPaint = Paint(); cPaint..color = Colors.white; cPaint..strokeWidth = 14 / 2; canvas.drawCircle(Offset(thumbCenter.dx, thumbCenter.dy), 12, cPaint); cPaint..color = colorTween.evaluate(enableAnimation); canvas.drawCircle(Offset(thumbCenter.dx, thumbCenter.dy), 10, cPaint); } double convertRadiusToSigma(double radius) { return radius * 0.57735 + 0.5; } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/custom_calendar.dart
import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; class CustomCalendarView extends StatefulWidget { const CustomCalendarView( {Key key, this.initialStartDate, this.initialEndDate, this.startEndDateChange, this.minimumDate, this.maximumDate}) : super(key: key); final DateTime minimumDate; final DateTime maximumDate; final DateTime initialStartDate; final DateTime initialEndDate; final Function(DateTime, DateTime) startEndDateChange; @override _CustomCalendarViewState createState() => _CustomCalendarViewState(); } class _CustomCalendarViewState extends State<CustomCalendarView> { List<DateTime> dateList = <DateTime>[]; DateTime currentMonthDate = DateTime.now(); DateTime startDate; DateTime endDate; @override void initState() { setListOfDate(currentMonthDate); if (widget.initialStartDate != null) { startDate = widget.initialStartDate; } if (widget.initialEndDate != null) { endDate = widget.initialEndDate; } super.initState(); } @override void dispose() { super.dispose(); } void setListOfDate(DateTime monthDate) { dateList.clear(); final DateTime newDate = DateTime(monthDate.year, monthDate.month, 0); int previousMothDay = 0; if (newDate.weekday < 7) { previousMothDay = newDate.weekday; for (int i = 1; i <= previousMothDay; i++) { dateList.add(newDate.subtract(Duration(days: previousMothDay - i))); } } for (int i = 0; i < (42 - previousMothDay); i++) { dateList.add(newDate.add(Duration(days: i + 1))); } // if (dateList[dateList.length - 7].month != monthDate.month) { // dateList.removeRange(dateList.length - 7, dateList.length); // } } @override Widget build(BuildContext context) { return Container( child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 4, bottom: 4), child: Row( children: <Widget>[ Padding( padding: const EdgeInsets.all(8.0), child: Container( height: 38, width: 38, decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(24.0)), border: Border.all( color: HotelAppTheme.buildLightTheme().dividerColor, ), ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(24.0)), onTap: () { setState(() { currentMonthDate = DateTime(currentMonthDate.year, currentMonthDate.month, 0); setListOfDate(currentMonthDate); }); }, child: Icon( Icons.keyboard_arrow_left, color: Colors.grey, ), ), ), ), ), Expanded( child: Center( child: Text( DateFormat('MMMM, yyyy').format(currentMonthDate), style: TextStyle( fontWeight: FontWeight.w500, fontSize: 20, color: Colors.black), ), ), ), Padding( padding: const EdgeInsets.all(8.0), child: Container( height: 38, width: 38, decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(24.0)), border: Border.all( color: HotelAppTheme.buildLightTheme().dividerColor, ), ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(24.0)), onTap: () { setState(() { currentMonthDate = DateTime(currentMonthDate.year, currentMonthDate.month + 2, 0); setListOfDate(currentMonthDate); }); }, child: Icon( Icons.keyboard_arrow_right, color: Colors.grey, ), ), ), ), ), ], ), ), Padding( padding: const EdgeInsets.only(right: 8, left: 8, bottom: 8), child: Row( children: getDaysNameUI(), ), ), Padding( padding: const EdgeInsets.only(right: 8, left: 8), child: Column( children: getDaysNoUI(), ), ), ], ), ); } List<Widget> getDaysNameUI() { final List<Widget> listUI = <Widget>[]; for (int i = 0; i < 7; i++) { listUI.add( Expanded( child: Center( child: Text( DateFormat('EEE').format(dateList[i]), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, color: HotelAppTheme.buildLightTheme().primaryColor), ), ), ), ); } return listUI; } List<Widget> getDaysNoUI() { final List<Widget> noList = <Widget>[]; int count = 0; for (int i = 0; i < dateList.length / 7; i++) { final List<Widget> listUI = <Widget>[]; for (int i = 0; i < 7; i++) { final DateTime date = dateList[count]; listUI.add( Expanded( child: AspectRatio( aspectRatio: 1.0, child: Container( child: Stack( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 3, bottom: 3), child: Material( color: Colors.transparent, child: Padding( padding: EdgeInsets.only( top: 2, bottom: 2, left: isStartDateRadius(date) ? 4 : 0, right: isEndDateRadius(date) ? 4 : 0), child: Container( decoration: BoxDecoration( color: startDate != null && endDate != null ? getIsItStartAndEndDate(date) || getIsInRange(date) ? HotelAppTheme.buildLightTheme() .primaryColor .withOpacity(0.4) : Colors.transparent : Colors.transparent, borderRadius: BorderRadius.only( bottomLeft: isStartDateRadius(date) ? const Radius.circular(24.0) : const Radius.circular(0.0), topLeft: isStartDateRadius(date) ? const Radius.circular(24.0) : const Radius.circular(0.0), topRight: isEndDateRadius(date) ? const Radius.circular(24.0) : const Radius.circular(0.0), bottomRight: isEndDateRadius(date) ? const Radius.circular(24.0) : const Radius.circular(0.0), ), ), ), ), ), ), Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(32.0)), onTap: () { if (currentMonthDate.month == date.month) { if (widget.minimumDate != null && widget.maximumDate != null) { final DateTime newminimumDate = DateTime( widget.minimumDate.year, widget.minimumDate.month, widget.minimumDate.day - 1); final DateTime newmaximumDate = DateTime( widget.maximumDate.year, widget.maximumDate.month, widget.maximumDate.day + 1); if (date.isAfter(newminimumDate) && date.isBefore(newmaximumDate)) { onDateClick(date); } } else if (widget.minimumDate != null) { final DateTime newminimumDate = DateTime( widget.minimumDate.year, widget.minimumDate.month, widget.minimumDate.day - 1); if (date.isAfter(newminimumDate)) { onDateClick(date); } } else if (widget.maximumDate != null) { final DateTime newmaximumDate = DateTime( widget.maximumDate.year, widget.maximumDate.month, widget.maximumDate.day + 1); if (date.isBefore(newmaximumDate)) { onDateClick(date); } } else { onDateClick(date); } } }, child: Padding( padding: const EdgeInsets.all(2), child: Container( decoration: BoxDecoration( color: getIsItStartAndEndDate(date) ? HotelAppTheme.buildLightTheme().primaryColor : Colors.transparent, borderRadius: const BorderRadius.all(Radius.circular(32.0)), border: Border.all( color: getIsItStartAndEndDate(date) ? Colors.white : Colors.transparent, width: 2, ), boxShadow: getIsItStartAndEndDate(date) ? <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.6), blurRadius: 4, offset: const Offset(0, 0)), ] : null, ), child: Center( child: Text( '${date.day}', style: TextStyle( color: getIsItStartAndEndDate(date) ? Colors.white : currentMonthDate.month == date.month ? Colors.black : Colors.grey.withOpacity(0.6), fontSize: MediaQuery.of(context).size.width > 360 ? 18 : 16, fontWeight: getIsItStartAndEndDate(date) ? FontWeight.bold : FontWeight.normal), ), ), ), ), ), ), Positioned( bottom: 9, right: 0, left: 0, child: Container( height: 6, width: 6, decoration: BoxDecoration( color: DateTime.now().day == date.day && DateTime.now().month == date.month && DateTime.now().year == date.year ? getIsInRange(date) ? Colors.white : HotelAppTheme.buildLightTheme() .primaryColor : Colors.transparent, shape: BoxShape.circle), ), ), ], ), ), ), ), ); count += 1; } noList.add(Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: listUI, )); } return noList; } bool getIsInRange(DateTime date) { if (startDate != null && endDate != null) { if (date.isAfter(startDate) && date.isBefore(endDate)) { return true; } else { return false; } } else { return false; } } bool getIsItStartAndEndDate(DateTime date) { if (startDate != null && startDate.day == date.day && startDate.month == date.month && startDate.year == date.year) { return true; } else if (endDate != null && endDate.day == date.day && endDate.month == date.month && endDate.year == date.year) { return true; } else { return false; } } bool isStartDateRadius(DateTime date) { if (startDate != null && startDate.day == date.day && startDate.month == date.month) { return true; } else if (date.weekday == 1) { return true; } else { return false; } } bool isEndDateRadius(DateTime date) { if (endDate != null && endDate.day == date.day && endDate.month == date.month) { return true; } else if (date.weekday == 7) { return true; } else { return false; } } void onDateClick(DateTime date) { if (startDate == null) { startDate = date; } else if (startDate != date && endDate == null) { endDate = date; } else if (startDate.day == date.day && startDate.month == date.month) { startDate = null; } else if (endDate.day == date.day && endDate.month == date.month) { endDate = null; } if (startDate == null && endDate != null) { startDate = endDate; endDate = null; } if (startDate != null && endDate != null) { if (!endDate.isAfter(startDate)) { final DateTime d = startDate; startDate = endDate; endDate = d; } if (date.isBefore(startDate)) { startDate = date; } if (date.isAfter(endDate)) { endDate = date; } } setState(() { try { widget.startEndDateChange(startDate, endDate); } catch (_) {} }); } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/hotel_app_theme.dart
import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; class HotelAppTheme { static TextTheme _buildTextTheme(TextTheme base) { const String fontName = 'WorkSans'; return base.copyWith( headline1: base.headline1.copyWith(fontFamily: fontName), headline2: base.headline2.copyWith(fontFamily: fontName), headline3: base.headline3.copyWith(fontFamily: fontName), headline4: base.headline4.copyWith(fontFamily: fontName), headline5: base.headline5.copyWith(fontFamily: fontName), headline6: base.headline6.copyWith(fontFamily: fontName), button: base.button.copyWith(fontFamily: fontName), caption: base.caption.copyWith(fontFamily: fontName), bodyText1: base.bodyText1.copyWith(fontFamily: fontName), bodyText2: base.bodyText2.copyWith(fontFamily: fontName), subtitle1: base.subtitle1.copyWith(fontFamily: fontName), subtitle2: base.subtitle2.copyWith(fontFamily: fontName), overline: base.overline.copyWith(fontFamily: fontName), ); } static ThemeData buildLightTheme() { final Color primaryColor = HexColor('#54D3C2'); final Color secondaryColor = HexColor('#54D3C2'); final ColorScheme colorScheme = const ColorScheme.light().copyWith( primary: primaryColor, secondary: secondaryColor, ); final ThemeData base = ThemeData.light(); return base.copyWith( colorScheme: colorScheme, primaryColor: primaryColor, buttonColor: primaryColor, indicatorColor: Colors.white, splashColor: Colors.white24, splashFactory: InkRipple.splashFactory, accentColor: secondaryColor, canvasColor: Colors.white, backgroundColor: const Color(0xFFFFFFFF), scaffoldBackgroundColor: const Color(0xFFF6F6F6), errorColor: const Color(0xFFB00020), buttonTheme: ButtonThemeData( colorScheme: colorScheme, textTheme: ButtonTextTheme.primary, ), textTheme: _buildTextTheme(base.textTheme), primaryTextTheme: _buildTextTheme(base.primaryTextTheme), accentTextTheme: _buildTextTheme(base.accentTextTheme), platform: TargetPlatform.iOS, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/filters_screen.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'range_slider_view.dart'; import 'slider_view.dart'; import 'hotel_app_theme.dart'; import 'model/popular_filter_list.dart'; class FiltersScreen extends StatefulWidget { @override _FiltersScreenState createState() => _FiltersScreenState(); } class _FiltersScreenState extends State<FiltersScreen> { List<PopularFilterListData> popularFilterListData = PopularFilterListData.popularFList; List<PopularFilterListData> accomodationListData = PopularFilterListData.accomodationList; RangeValues _values = const RangeValues(100, 600); double distValue = 50.0; @override Widget build(BuildContext context) { return Container( color: HotelAppTheme.buildLightTheme().backgroundColor, child: Scaffold( backgroundColor: Colors.transparent, body: Column( children: <Widget>[ getAppBarUI(), Expanded( child: SingleChildScrollView( child: Column( children: <Widget>[ priceBarFilter(), const Divider( height: 1, ), popularFilter(), const Divider( height: 1, ), distanceViewUI(), const Divider( height: 1, ), allAccommodationUI() ], ), ), ), const Divider( height: 1, ), Padding( padding: const EdgeInsets.only( left: 16, right: 16, bottom: 16, top: 8), child: Container( height: 48, decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().primaryColor, borderRadius: const BorderRadius.all(Radius.circular(24.0)), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.6), blurRadius: 8, offset: const Offset(4, 4), ), ], ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(24.0)), highlightColor: Colors.transparent, onTap: () { Navigator.pop(context); }, child: Center( child: Text( 'Apply', style: TextStyle( fontWeight: FontWeight.w500, fontSize: 18, color: Colors.white), ), ), ), ), ), ) ], ), ), ); } Widget allAccommodationUI() { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8), child: Text( 'Type of Accommodation', textAlign: TextAlign.left, style: TextStyle( color: Colors.grey, fontSize: MediaQuery.of(context).size.width > 360 ? 18 : 16, fontWeight: FontWeight.normal), ), ), Padding( padding: const EdgeInsets.only(right: 16, left: 16), child: Column( children: getAccomodationListUI(), ), ), const SizedBox( height: 8, ), ], ); } List<Widget> getAccomodationListUI() { final List<Widget> noList = <Widget>[]; for (int i = 0; i < accomodationListData.length; i++) { final PopularFilterListData date = accomodationListData[i]; noList.add( Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(4.0)), onTap: () { setState(() { checkAppPosition(i); }); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Row( children: <Widget>[ Expanded( child: Text( date.titleTxt, style: TextStyle(color: Colors.black), ), ), CupertinoSwitch( activeColor: date.isSelected ? HotelAppTheme.buildLightTheme().primaryColor : Colors.grey.withOpacity(0.6), onChanged: (bool value) { setState(() { checkAppPosition(i); }); }, value: date.isSelected, ), ], ), ), ), ), ); if (i == 0) { noList.add(const Divider( height: 1, )); } } return noList; } void checkAppPosition(int index) { if (index == 0) { if (accomodationListData[0].isSelected) { accomodationListData.forEach((d) { d.isSelected = false; }); } else { accomodationListData.forEach((d) { d.isSelected = true; }); } } else { accomodationListData[index].isSelected = !accomodationListData[index].isSelected; int count = 0; for (int i = 0; i < accomodationListData.length; i++) { if (i != 0) { final PopularFilterListData data = accomodationListData[i]; if (data.isSelected) { count += 1; } } } if (count == accomodationListData.length - 1) { accomodationListData[0].isSelected = true; } else { accomodationListData[0].isSelected = false; } } } Widget distanceViewUI() { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8), child: Text( 'Distance from city center', textAlign: TextAlign.left, style: TextStyle( color: Colors.grey, fontSize: MediaQuery.of(context).size.width > 360 ? 18 : 16, fontWeight: FontWeight.normal), ), ), SliderView( distValue: distValue, onChangedistValue: (double value) { distValue = value; }, ), const SizedBox( height: 8, ), ], ); } Widget popularFilter() { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8), child: Text( 'Popular filters', textAlign: TextAlign.left, style: TextStyle( color: Colors.grey, fontSize: MediaQuery.of(context).size.width > 360 ? 18 : 16, fontWeight: FontWeight.normal), ), ), Padding( padding: const EdgeInsets.only(right: 16, left: 16), child: Column( children: getPList(), ), ), const SizedBox( height: 8, ) ], ); } List<Widget> getPList() { final List<Widget> noList = <Widget>[]; int count = 0; const int columnCount = 2; for (int i = 0; i < popularFilterListData.length / columnCount; i++) { final List<Widget> listUI = <Widget>[]; for (int i = 0; i < columnCount; i++) { try { final PopularFilterListData date = popularFilterListData[count]; listUI.add(Expanded( child: Row( children: <Widget>[ Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(4.0)), onTap: () { setState(() { date.isSelected = !date.isSelected; }); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Row( children: <Widget>[ Icon( date.isSelected ? Icons.check_box : Icons.check_box_outline_blank, color: date.isSelected ? HotelAppTheme.buildLightTheme().primaryColor : Colors.grey.withOpacity(0.6), ), const SizedBox( width: 4, ), Text( date.titleTxt, ), ], ), ), ), ), ], ), )); if (count < popularFilterListData.length - 1) { count += 1; } else { break; } } catch (e) { print(e); } } noList.add(Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: listUI, )); } return noList; } Widget priceBarFilter() { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.all(16.0), child: Text( 'Price (for 1 night)', textAlign: TextAlign.left, style: TextStyle( color: Colors.grey, fontSize: MediaQuery.of(context).size.width > 360 ? 18 : 16, fontWeight: FontWeight.normal), ), ), RangeSliderView( values: _values, onChangeRangeValues: (RangeValues values) { _values = values; }, ), const SizedBox( height: 8, ) ], ); } Widget getAppBarUI() { return Container( decoration: BoxDecoration( color: HotelAppTheme.buildLightTheme().backgroundColor, boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.2), offset: const Offset(0, 2), blurRadius: 4.0), ], ), child: Padding( padding: EdgeInsets.only( top: MediaQuery.of(context).padding.top, left: 8, right: 8), child: Row( children: <Widget>[ Container( alignment: Alignment.centerLeft, width: AppBar().preferredSize.height + 40, height: AppBar().preferredSize.height, child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () { Navigator.pop(context); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Icon(Icons.close), ), ), ), ), Expanded( child: Center( child: Text( 'Filters', style: TextStyle( fontWeight: FontWeight.w600, fontSize: 22, ), ), ), ), Container( width: AppBar().preferredSize.height + 40, height: AppBar().preferredSize.height, ) ], ), ), ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/hotel_list_view.dart
import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:smooth_star_rating/smooth_star_rating.dart'; import 'model/hotel_list_data.dart'; class HotelListView extends StatelessWidget { const HotelListView( {Key key, this.hotelData, this.animationController, this.animation, this.callback}) : super(key: key); final VoidCallback callback; final HotelListData hotelData; final AnimationController animationController; final Animation<dynamic> animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: Transform( transform: Matrix4.translationValues( 0.0, 50 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 8, bottom: 16), child: InkWell( splashColor: Colors.transparent, onTap: () { callback(); }, child: Container( decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(16.0)), boxShadow: <BoxShadow>[ BoxShadow( color: Colors.grey.withOpacity(0.6), offset: const Offset(4, 4), blurRadius: 16, ), ], ), child: ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(16.0)), child: Stack( children: <Widget>[ Column( children: <Widget>[ AspectRatio( aspectRatio: 2, child: Image.asset( hotelData.imagePath, fit: BoxFit.cover, ), ), Container( color: HotelAppTheme.buildLightTheme() .backgroundColor, child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Expanded( child: Container( child: Padding( padding: const EdgeInsets.only( left: 16, top: 8, bottom: 8), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( hotelData.titleTxt, textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 22, ), ), Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ Text( hotelData.subTxt, style: TextStyle( fontSize: 14, color: Colors.grey .withOpacity(0.8)), ), const SizedBox( width: 4, ), Icon( FontAwesomeIcons.mapMarkerAlt, size: 12, color: HotelAppTheme .buildLightTheme() .primaryColor, ), Expanded( child: Text( '${hotelData.dist.toStringAsFixed(1)} km to city', overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 14, color: Colors.grey .withOpacity(0.8)), ), ), ], ), Padding( padding: const EdgeInsets.only(top: 4), child: Row( children: <Widget>[ SmoothStarRating( allowHalfRating: true, starCount: 5, rating: hotelData.rating, size: 20, color: HotelAppTheme .buildLightTheme() .primaryColor, borderColor: HotelAppTheme .buildLightTheme() .primaryColor, ), Text( ' ${hotelData.reviews} Reviews', style: TextStyle( fontSize: 14, color: Colors.grey .withOpacity(0.8)), ), ], ), ), ], ), ), ), ), Padding( padding: const EdgeInsets.only( right: 16, top: 8), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Text( '\$${hotelData.perNight}', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 22, ), ), Text( '/per night', style: TextStyle( fontSize: 14, color: Colors.grey.withOpacity(0.8)), ), ], ), ), ], ), ), ], ), Positioned( top: 8, right: 8, child: Material( color: Colors.transparent, child: InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () {}, child: Padding( padding: const EdgeInsets.all(8.0), child: Icon( Icons.favorite_border, color: HotelAppTheme.buildLightTheme() .primaryColor, ), ), ), ), ) ], ), ), ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/model/popular_filter_list.dart
class PopularFilterListData { PopularFilterListData({ this.titleTxt = '', this.isSelected = false, }); String titleTxt; bool isSelected; static List<PopularFilterListData> popularFList = <PopularFilterListData>[ PopularFilterListData( titleTxt: 'Free Breakfast', isSelected: false, ), PopularFilterListData( titleTxt: 'Free Parking', isSelected: false, ), PopularFilterListData( titleTxt: 'Pool', isSelected: true, ), PopularFilterListData( titleTxt: 'Pet Friendly', isSelected: false, ), PopularFilterListData( titleTxt: 'Free wifi', isSelected: false, ), ]; static List<PopularFilterListData> accomodationList = [ PopularFilterListData( titleTxt: 'All', isSelected: false, ), PopularFilterListData( titleTxt: 'Apartment', isSelected: false, ), PopularFilterListData( titleTxt: 'Home', isSelected: true, ), PopularFilterListData( titleTxt: 'Villa', isSelected: false, ), PopularFilterListData( titleTxt: 'Hotel', isSelected: false, ), PopularFilterListData( titleTxt: 'Resort', isSelected: false, ), ]; }
0
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking
mirrored_repositories/best_flutter_ui_templates/lib/hotel_booking/model/hotel_list_data.dart
class HotelListData { HotelListData({ this.imagePath = '', this.titleTxt = '', this.subTxt = "", this.dist = 1.8, this.reviews = 80, this.rating = 4.5, this.perNight = 180, }); String imagePath; String titleTxt; String subTxt; double dist; double rating; int reviews; int perNight; static List<HotelListData> hotelList = <HotelListData>[ HotelListData( imagePath: 'assets/hotel/hotel_1.png', titleTxt: 'Grand Royal Hotel', subTxt: 'Wembley, London', dist: 2.0, reviews: 80, rating: 4.4, perNight: 180, ), HotelListData( imagePath: 'assets/hotel/hotel_2.png', titleTxt: 'Queen Hotel', subTxt: 'Wembley, London', dist: 4.0, reviews: 74, rating: 4.5, perNight: 200, ), HotelListData( imagePath: 'assets/hotel/hotel_3.png', titleTxt: 'Grand Royal Hotel', subTxt: 'Wembley, London', dist: 3.0, reviews: 62, rating: 4.0, perNight: 60, ), HotelListData( imagePath: 'assets/hotel/hotel_4.png', titleTxt: 'Queen Hotel', subTxt: 'Wembley, London', dist: 7.0, reviews: 90, rating: 4.4, perNight: 170, ), HotelListData( imagePath: 'assets/hotel/hotel_5.png', titleTxt: 'Grand Royal Hotel', subTxt: 'Wembley, London', dist: 2.0, reviews: 240, rating: 4.5, perNight: 200, ), ]; }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/custom_drawer/home_drawer.dart
import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:flutter/material.dart'; class HomeDrawer extends StatefulWidget { const HomeDrawer( {Key key, this.screenIndex, this.iconAnimationController, this.callBackIndex}) : super(key: key); final AnimationController iconAnimationController; final DrawerIndex screenIndex; final Function(DrawerIndex) callBackIndex; @override _HomeDrawerState createState() => _HomeDrawerState(); } class _HomeDrawerState extends State<HomeDrawer> { List<DrawerList> drawerList; @override void initState() { setDrawerListArray(); super.initState(); } void setDrawerListArray() { drawerList = <DrawerList>[ DrawerList( index: DrawerIndex.HOME, labelName: 'Home', icon: Icon(Icons.home), ), DrawerList( index: DrawerIndex.Help, labelName: 'Help', isAssetsImage: true, imageName: 'assets/images/supportIcon.png', ), DrawerList( index: DrawerIndex.FeedBack, labelName: 'FeedBack', icon: Icon(Icons.help), ), DrawerList( index: DrawerIndex.Invite, labelName: 'Invite Friend', icon: Icon(Icons.group), ), DrawerList( index: DrawerIndex.Share, labelName: 'Rate the app', icon: Icon(Icons.share), ), DrawerList( index: DrawerIndex.About, labelName: 'About Us', icon: Icon(Icons.info), ), ]; } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppTheme.notWhite.withOpacity(0.5), body: Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ Container( width: double.infinity, padding: const EdgeInsets.only(top: 40.0), child: Container( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ AnimatedBuilder( animation: widget.iconAnimationController, builder: (BuildContext context, Widget child) { return ScaleTransition( scale: AlwaysStoppedAnimation<double>( 1.0 - (widget.iconAnimationController.value) * 0.2), child: RotationTransition( turns: AlwaysStoppedAnimation<double>(Tween<double>( begin: 0.0, end: 24.0) .animate(CurvedAnimation( parent: widget.iconAnimationController, curve: Curves.fastOutSlowIn)) .value / 360), child: Container( height: 120, width: 120, decoration: BoxDecoration( shape: BoxShape.circle, boxShadow: <BoxShadow>[ BoxShadow( color: AppTheme.grey.withOpacity(0.6), offset: const Offset(2.0, 4.0), blurRadius: 8), ], ), child: ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(60.0)), child: Image.asset('assets/images/userImage.jpg'), ), ), ), ); }, ), Padding( padding: const EdgeInsets.only(top: 8, left: 4), child: Text( 'Ahmer Iqbal', style: TextStyle( fontWeight: FontWeight.w600, color: AppTheme.grey, fontSize: 18, ), ), ), ], ), ), ), const SizedBox( height: 4, ), Divider( height: 1, color: AppTheme.grey.withOpacity(0.6), ), Expanded( child: ListView.builder( physics: const BouncingScrollPhysics(), padding: const EdgeInsets.all(0.0), itemCount: drawerList.length, itemBuilder: (BuildContext context, int index) { return inkwell(drawerList[index]); }, ), ), Divider( height: 1, color: AppTheme.grey.withOpacity(0.6), ), Column( children: <Widget>[ ListTile( title: Text( 'Sign Out', style: TextStyle( fontFamily: AppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 16, color: AppTheme.darkText, ), textAlign: TextAlign.left, ), trailing: Icon( Icons.power_settings_new, color: Colors.red, ), onTap: () {}, ), SizedBox( height: MediaQuery.of(context).padding.bottom, ) ], ), ], ), ); } Widget inkwell(DrawerList listData) { return Material( color: Colors.transparent, child: InkWell( splashColor: Colors.grey.withOpacity(0.1), highlightColor: Colors.transparent, onTap: () { navigationtoScreen(listData.index); }, child: Stack( children: <Widget>[ Container( padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), child: Row( children: <Widget>[ Container( width: 6.0, height: 46.0, // decoration: BoxDecoration( // color: widget.screenIndex == listData.index // ? Colors.blue // : Colors.transparent, // borderRadius: new BorderRadius.only( // topLeft: Radius.circular(0), // topRight: Radius.circular(16), // bottomLeft: Radius.circular(0), // bottomRight: Radius.circular(16), // ), // ), ), const Padding( padding: EdgeInsets.all(4.0), ), listData.isAssetsImage ? Container( width: 24, height: 24, child: Image.asset(listData.imageName, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack), ) : Icon(listData.icon.icon, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack), const Padding( padding: EdgeInsets.all(4.0), ), Text( listData.labelName, style: TextStyle( fontWeight: FontWeight.w500, fontSize: 16, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack, ), textAlign: TextAlign.left, ), ], ), ), widget.screenIndex == listData.index ? AnimatedBuilder( animation: widget.iconAnimationController, builder: (BuildContext context, Widget child) { return Transform( transform: Matrix4.translationValues( (MediaQuery.of(context).size.width * 0.75 - 64) * (1.0 - widget.iconAnimationController.value - 1.0), 0.0, 0.0), child: Padding( padding: EdgeInsets.only(top: 8, bottom: 8), child: Container( width: MediaQuery.of(context).size.width * 0.75 - 64, height: 46, decoration: BoxDecoration( color: Colors.blue.withOpacity(0.2), borderRadius: new BorderRadius.only( topLeft: Radius.circular(0), topRight: Radius.circular(28), bottomLeft: Radius.circular(0), bottomRight: Radius.circular(28), ), ), ), ), ); }, ) : const SizedBox() ], ), ), ); } Future<void> navigationtoScreen(DrawerIndex indexScreen) async { widget.callBackIndex(indexScreen); } } enum DrawerIndex { HOME, FeedBack, Help, Share, About, Invite, Testing, } class DrawerList { DrawerList({ this.isAssetsImage = false, this.labelName = '', this.icon, this.index, this.imageName = '', }); String labelName; Icon icon; bool isAssetsImage; String imageName; DrawerIndex index; }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/custom_drawer/drawer_user_controller.dart
import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:best_flutter_ui_templates/custom_drawer/home_drawer.dart'; import 'package:flutter/material.dart'; class DrawerUserController extends StatefulWidget { const DrawerUserController({ Key key, this.drawerWidth = 250, this.onDrawerCall, this.screenView, this.animatedIconData = AnimatedIcons.arrow_menu, this.menuView, this.drawerIsOpen, this.screenIndex, }) : super(key: key); final double drawerWidth; final Function(DrawerIndex) onDrawerCall; final Widget screenView; final Function(bool) drawerIsOpen; final AnimatedIconData animatedIconData; final Widget menuView; final DrawerIndex screenIndex; @override _DrawerUserControllerState createState() => _DrawerUserControllerState(); } class _DrawerUserControllerState extends State<DrawerUserController> with TickerProviderStateMixin { ScrollController scrollController; AnimationController iconAnimationController; AnimationController animationController; double scrolloffset = 0.0; @override void initState() { animationController = AnimationController(duration: const Duration(milliseconds: 2000), vsync: this); iconAnimationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 0)); iconAnimationController..animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); scrollController = ScrollController(initialScrollOffset: widget.drawerWidth); scrollController ..addListener(() { if (scrollController.offset <= 0) { if (scrolloffset != 1.0) { setState(() { scrolloffset = 1.0; try { widget.drawerIsOpen(true); } catch (_) {} }); } iconAnimationController.animateTo(0.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); } else if (scrollController.offset > 0 && scrollController.offset < widget.drawerWidth.floor()) { iconAnimationController.animateTo((scrollController.offset * 100 / (widget.drawerWidth)) / 100, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); } else { if (scrolloffset != 0.0) { setState(() { scrolloffset = 0.0; try { widget.drawerIsOpen(false); } catch (_) {} }); } iconAnimationController.animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); } }); WidgetsBinding.instance.addPostFrameCallback((_) => getInitState()); super.initState(); } Future<bool> getInitState() async { scrollController.jumpTo( widget.drawerWidth, ); return true; } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppTheme.white, body: SingleChildScrollView( controller: scrollController, scrollDirection: Axis.horizontal, physics: const PageScrollPhysics(parent: ClampingScrollPhysics()), child: SizedBox( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width + widget.drawerWidth, //we use with as screen width and add drawerWidth (from navigation_home_screen) child: Row( children: <Widget>[ SizedBox( width: widget.drawerWidth, //we divided first drawer Width with HomeDrawer and second full-screen Width with all home screen, we called screen View height: MediaQuery.of(context).size.height, child: AnimatedBuilder( animation: iconAnimationController, builder: (BuildContext context, Widget child) { return Transform( //transform we use for the stable drawer we, not need to move with scroll view transform: Matrix4.translationValues(scrollController.offset, 0.0, 0.0), child: HomeDrawer( screenIndex: widget.screenIndex == null ? DrawerIndex.HOME : widget.screenIndex, iconAnimationController: iconAnimationController, callBackIndex: (DrawerIndex indexType) { onDrawerClick(); try { widget.onDrawerCall(indexType); } catch (e) {} }, ), ); }, ), ), SizedBox( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, //full-screen Width with widget.screenView child: Container( decoration: BoxDecoration( color: AppTheme.white, boxShadow: <BoxShadow>[ BoxShadow(color: AppTheme.grey.withOpacity(0.6), blurRadius: 24), ], ), child: Stack( children: <Widget>[ //this IgnorePointer we use as touch(user Interface) widget.screen View, for example scrolloffset == 1 means drawer is close we just allow touching all widget.screen View IgnorePointer( ignoring: scrolloffset == 1 || false, child: widget.screenView, ), //alternative touch(user Interface) for widget.screen, for example, drawer is close we need to tap on a few home screen area and close the drawer if (scrolloffset == 1.0) InkWell( onTap: () { onDrawerClick(); }, ), // this just menu and arrow icon animation Padding( padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top + 8, left: 8), child: SizedBox( width: AppBar().preferredSize.height - 8, height: AppBar().preferredSize.height - 8, child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(AppBar().preferredSize.height), child: Center( // if you use your own menu view UI you add form initialization child: widget.menuView != null ? widget.menuView : AnimatedIcon( icon: widget.animatedIconData != null ? widget.animatedIconData : AnimatedIcons.arrow_menu, progress: iconAnimationController), ), onTap: () { FocusScope.of(context).requestFocus(FocusNode()); onDrawerClick(); }, ), ), ), ), ], ), ), ), ], ), ), ), ); } void onDrawerClick() { //if scrollcontroller.offset != 0.0 then we set to closed the drawer(with animation to offset zero position) if is not 1 then open the drawer if (scrollController.offset != 0.0) { scrollController.animateTo( 0.0, duration: const Duration(milliseconds: 400), curve: Curves.fastOutSlowIn, ); } else { scrollController.animateTo( widget.drawerWidth, duration: const Duration(milliseconds: 400), curve: Curves.fastOutSlowIn, ); } } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/design_course/home_design_course.dart
import 'package:best_flutter_ui_templates/design_course/category_list_view.dart'; import 'package:best_flutter_ui_templates/design_course/course_info_screen.dart'; import 'package:best_flutter_ui_templates/design_course/popular_course_list_view.dart'; import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; import 'design_course_app_theme.dart'; class DesignCourseHomeScreen extends StatefulWidget { @override _DesignCourseHomeScreenState createState() => _DesignCourseHomeScreenState(); } class _DesignCourseHomeScreenState extends State<DesignCourseHomeScreen> { CategoryType categoryType = CategoryType.ui; @override Widget build(BuildContext context) { return Container( color: DesignCourseAppTheme.nearlyWhite, child: Scaffold( backgroundColor: Colors.transparent, body: Column( children: <Widget>[ SizedBox( height: MediaQuery.of(context).padding.top, ), getAppBarUI(), Expanded( child: SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height, child: Column( children: <Widget>[ getSearchBarUI(), getCategoryUI(), Flexible( child: getPopularCourseUI(), ), ], ), ), ), ), ], ), ), ); } Widget getCategoryUI() { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 8.0, left: 18, right: 16), child: Text( 'Category', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 22, letterSpacing: 0.27, color: DesignCourseAppTheme.darkerText, ), ), ), const SizedBox( height: 16, ), Padding( padding: const EdgeInsets.only(left: 16, right: 16), child: Row( children: <Widget>[ getButtonUI(CategoryType.ui, categoryType == CategoryType.ui), const SizedBox( width: 16, ), getButtonUI( CategoryType.coding, categoryType == CategoryType.coding), const SizedBox( width: 16, ), getButtonUI( CategoryType.basic, categoryType == CategoryType.basic), ], ), ), const SizedBox( height: 16, ), CategoryListView( callBack: () { moveTo(); }, ), ], ); } Widget getPopularCourseUI() { return Padding( padding: const EdgeInsets.only(top: 8.0, left: 18, right: 16), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Popular Course', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 22, letterSpacing: 0.27, color: DesignCourseAppTheme.darkerText, ), ), Flexible( child: PopularCourseListView( callBack: () { moveTo(); }, ), ) ], ), ); } void moveTo() { Navigator.push<dynamic>( context, MaterialPageRoute<dynamic>( builder: (BuildContext context) => CourseInfoScreen(), ), ); } Widget getButtonUI(CategoryType categoryTypeData, bool isSelected) { String txt = ''; if (CategoryType.ui == categoryTypeData) { txt = 'Ui/Ux'; } else if (CategoryType.coding == categoryTypeData) { txt = 'Coding'; } else if (CategoryType.basic == categoryTypeData) { txt = 'Basic UI'; } return Expanded( child: Container( decoration: BoxDecoration( color: isSelected ? DesignCourseAppTheme.nearlyBlue : DesignCourseAppTheme.nearlyWhite, borderRadius: const BorderRadius.all(Radius.circular(24.0)), border: Border.all(color: DesignCourseAppTheme.nearlyBlue)), child: Material( color: Colors.transparent, child: InkWell( splashColor: Colors.white24, borderRadius: const BorderRadius.all(Radius.circular(24.0)), onTap: () { setState(() { categoryType = categoryTypeData; }); }, child: Padding( padding: const EdgeInsets.only( top: 12, bottom: 12, left: 18, right: 18), child: Center( child: Text( txt, textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0.27, color: isSelected ? DesignCourseAppTheme.nearlyWhite : DesignCourseAppTheme.nearlyBlue, ), ), ), ), ), ), ), ); } Widget getSearchBarUI() { return Padding( padding: const EdgeInsets.only(top: 8.0, left: 18), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( width: MediaQuery.of(context).size.width * 0.75, height: 64, child: Padding( padding: const EdgeInsets.only(top: 8, bottom: 8), child: Container( decoration: BoxDecoration( color: HexColor('#F8FAFB'), borderRadius: const BorderRadius.only( bottomRight: Radius.circular(13.0), bottomLeft: Radius.circular(13.0), topLeft: Radius.circular(13.0), topRight: Radius.circular(13.0), ), ), child: Row( children: <Widget>[ Expanded( child: Container( padding: const EdgeInsets.only(left: 16, right: 16), child: TextFormField( style: TextStyle( fontFamily: 'WorkSans', fontWeight: FontWeight.bold, fontSize: 16, color: DesignCourseAppTheme.nearlyBlue, ), keyboardType: TextInputType.text, decoration: InputDecoration( labelText: 'Search for course', border: InputBorder.none, helperStyle: TextStyle( fontWeight: FontWeight.bold, fontSize: 16, color: HexColor('#B9BABC'), ), labelStyle: TextStyle( fontWeight: FontWeight.w600, fontSize: 16, letterSpacing: 0.2, color: HexColor('#B9BABC'), ), ), onEditingComplete: () {}, ), ), ), SizedBox( width: 60, height: 60, child: Icon(Icons.search, color: HexColor('#B9BABC')), ) ], ), ), ), ), const Expanded( child: SizedBox(), ) ], ), ); } Widget getAppBarUI() { return Padding( padding: const EdgeInsets.only(top: 8.0, left: 18, right: 18), child: Row( children: <Widget>[ Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Choose your', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w400, fontSize: 14, letterSpacing: 0.2, color: DesignCourseAppTheme.grey, ), ), Text( 'Design Course', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 22, letterSpacing: 0.27, color: DesignCourseAppTheme.darkerText, ), ), ], ), ), Container( width: 60, height: 60, child: Image.asset('assets/design_course/userImage.png'), ) ], ), ); } } enum CategoryType { ui, coding, basic, }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/design_course/design_course_app_theme.dart
import 'package:flutter/material.dart'; class DesignCourseAppTheme { DesignCourseAppTheme._(); static const Color notWhite = Color(0xFFEDF0F2); static const Color nearlyWhite = Color(0xFFFFFFFF); static const Color nearlyBlue = Color(0xFF00B6F0); static const Color nearlyBlack = Color(0xFF213333); static const Color grey = Color(0xFF3A5160); static const Color dark_grey = Color(0xFF313A44); static const Color darkText = Color(0xFF253840); static const Color darkerText = Color(0xFF17262A); static const Color lightText = Color(0xFF4A6572); static const Color deactivatedText = Color(0xFF767676); static const Color dismissibleBackground = Color(0xFF364A54); static const Color chipBackground = Color(0xFFEEF1F3); static const Color spacer = Color(0xFFF2F2F2); static const TextTheme textTheme = TextTheme( headline4: display1, headline5: headline, headline6: title, subtitle2: subtitle, bodyText1: body2, bodyText2: body1, caption: caption, ); static const TextStyle display1 = TextStyle( // h4 -> display1 fontFamily: 'WorkSans', fontWeight: FontWeight.bold, fontSize: 36, letterSpacing: 0.4, height: 0.9, color: darkerText, ); static const TextStyle headline = TextStyle( // h5 -> headline fontFamily: 'WorkSans', fontWeight: FontWeight.bold, fontSize: 24, letterSpacing: 0.27, color: darkerText, ); static const TextStyle title = TextStyle( // h6 -> title fontFamily: 'WorkSans', fontWeight: FontWeight.bold, fontSize: 16, letterSpacing: 0.18, color: darkerText, ); static const TextStyle subtitle = TextStyle( // subtitle2 -> subtitle fontFamily: 'WorkSans', fontWeight: FontWeight.w400, fontSize: 14, letterSpacing: -0.04, color: darkText, ); static const TextStyle body2 = TextStyle( // body1 -> body2 fontFamily: 'WorkSans', fontWeight: FontWeight.w400, fontSize: 14, letterSpacing: 0.2, color: darkText, ); static const TextStyle body1 = TextStyle( // body2 -> body1 fontFamily: 'WorkSans', fontWeight: FontWeight.w400, fontSize: 16, letterSpacing: -0.05, color: darkText, ); static const TextStyle caption = TextStyle( // Caption -> caption fontFamily: 'WorkSans', fontWeight: FontWeight.w400, fontSize: 12, letterSpacing: 0.2, color: lightText, // was lightText ); }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/design_course/popular_course_list_view.dart
import 'package:best_flutter_ui_templates/design_course/design_course_app_theme.dart'; import 'package:best_flutter_ui_templates/design_course/models/category.dart'; import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; class PopularCourseListView extends StatefulWidget { const PopularCourseListView({Key key, this.callBack}) : super(key: key); final Function callBack; @override _PopularCourseListViewState createState() => _PopularCourseListViewState(); } class _PopularCourseListViewState extends State<PopularCourseListView> with TickerProviderStateMixin { AnimationController animationController; @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 2000), vsync: this); super.initState(); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 200)); return true; } @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only(top: 8), child: FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return GridView( padding: const EdgeInsets.all(8), physics: const BouncingScrollPhysics(), scrollDirection: Axis.vertical, children: List<Widget>.generate( Category.popularCourseList.length, (int index) { final int count = Category.popularCourseList.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval((1 / count) * index, 1.0, curve: Curves.fastOutSlowIn), ), ); animationController.forward(); return CategoryView( callback: () { widget.callBack(); }, category: Category.popularCourseList[index], animation: animation, animationController: animationController, ); }, ), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, mainAxisSpacing: 32.0, crossAxisSpacing: 32.0, childAspectRatio: 0.8, ), ); } }, ), ); } } class CategoryView extends StatelessWidget { const CategoryView( {Key key, this.category, this.animationController, this.animation, this.callback}) : super(key: key); final VoidCallback callback; final Category category; final AnimationController animationController; final Animation<dynamic> animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: Transform( transform: Matrix4.translationValues( 0.0, 50 * (1.0 - animation.value), 0.0), child: InkWell( splashColor: Colors.transparent, onTap: () { callback(); }, child: SizedBox( height: 280, child: Stack( alignment: AlignmentDirectional.bottomCenter, children: <Widget>[ Container( child: Column( children: <Widget>[ Expanded( child: Container( decoration: BoxDecoration( color: HexColor('#F8FAFB'), borderRadius: const BorderRadius.all( Radius.circular(16.0)), // border: new Border.all( // color: DesignCourseAppTheme.notWhite), ), child: Column( children: <Widget>[ Expanded( child: Container( child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only( top: 16, left: 16, right: 16), child: Text( category.title, textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 16, letterSpacing: 0.27, color: DesignCourseAppTheme .darkerText, ), ), ), Padding( padding: const EdgeInsets.only( top: 8, left: 16, right: 16, bottom: 8), child: Row( mainAxisAlignment: MainAxisAlignment .spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( '${category.lessonCount} lesson', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 12, letterSpacing: 0.27, color: DesignCourseAppTheme .grey, ), ), Container( child: Row( children: <Widget>[ Text( '${category.rating}', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 18, letterSpacing: 0.27, color: DesignCourseAppTheme .grey, ), ), Icon( Icons.star, color: DesignCourseAppTheme .nearlyBlue, size: 20, ), ], ), ) ], ), ), ], ), ), ), const SizedBox( width: 48, ), ], ), ), ), const SizedBox( height: 48, ), ], ), ), Container( child: Padding( padding: const EdgeInsets.only(top: 24, right: 16, left: 16), child: Container( decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(16.0)), boxShadow: <BoxShadow>[ BoxShadow( color: DesignCourseAppTheme.grey .withOpacity(0.2), offset: const Offset(0.0, 0.0), blurRadius: 6.0), ], ), child: ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(16.0)), child: AspectRatio( aspectRatio: 1.28, child: Image.asset(category.imagePath)), ), ), ), ), ], ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/design_course/category_list_view.dart
import 'package:best_flutter_ui_templates/design_course/design_course_app_theme.dart'; import 'package:best_flutter_ui_templates/design_course/models/category.dart'; import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; class CategoryListView extends StatefulWidget { const CategoryListView({Key key, this.callBack}) : super(key: key); final Function callBack; @override _CategoryListViewState createState() => _CategoryListViewState(); } class _CategoryListViewState extends State<CategoryListView> with TickerProviderStateMixin { AnimationController animationController; @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 2000), vsync: this); super.initState(); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 50)); return true; } @override void dispose() { animationController?.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only(top: 16, bottom: 16), child: Container( height: 134, width: double.infinity, child: FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return ListView.builder( padding: const EdgeInsets.only( top: 0, bottom: 0, right: 16, left: 16), itemCount: Category.categoryList.length, scrollDirection: Axis.horizontal, itemBuilder: (BuildContext context, int index) { final int count = Category.categoryList.length > 10 ? 10 : Category.categoryList.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval((1 / count) * index, 1.0, curve: Curves.fastOutSlowIn))); animationController.forward(); return CategoryView( category: Category.categoryList[index], animation: animation, animationController: animationController, callback: () { widget.callBack(); }, ); }, ); } }, ), ), ); } } class CategoryView extends StatelessWidget { const CategoryView( {Key key, this.category, this.animationController, this.animation, this.callback}) : super(key: key); final VoidCallback callback; final Category category; final AnimationController animationController; final Animation<dynamic> animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: Transform( transform: Matrix4.translationValues( 100 * (1.0 - animation.value), 0.0, 0.0), child: InkWell( splashColor: Colors.transparent, onTap: () { callback(); }, child: SizedBox( width: 280, child: Stack( children: <Widget>[ Container( child: Row( children: <Widget>[ const SizedBox( width: 48, ), Expanded( child: Container( decoration: BoxDecoration( color: HexColor('#F8FAFB'), borderRadius: const BorderRadius.all( Radius.circular(16.0)), ), child: Row( children: <Widget>[ const SizedBox( width: 48 + 24.0, ), Expanded( child: Container( child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 16), child: Text( category.title, textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 16, letterSpacing: 0.27, color: DesignCourseAppTheme .darkerText, ), ), ), const Expanded( child: SizedBox(), ), Padding( padding: const EdgeInsets.only( right: 16, bottom: 8), child: Row( mainAxisAlignment: MainAxisAlignment .spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( '${category.lessonCount} lesson', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 12, letterSpacing: 0.27, color: DesignCourseAppTheme .grey, ), ), Container( child: Row( children: <Widget>[ Text( '${category.rating}', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 18, letterSpacing: 0.27, color: DesignCourseAppTheme .grey, ), ), Icon( Icons.star, color: DesignCourseAppTheme .nearlyBlue, size: 20, ), ], ), ) ], ), ), Padding( padding: const EdgeInsets.only( bottom: 16, right: 16), child: Row( mainAxisAlignment: MainAxisAlignment .spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( '\$${category.money}', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 18, letterSpacing: 0.27, color: DesignCourseAppTheme .nearlyBlue, ), ), Container( decoration: BoxDecoration( color: DesignCourseAppTheme .nearlyBlue, borderRadius: const BorderRadius.all( Radius.circular( 8.0)), ), child: Padding( padding: const EdgeInsets.all( 4.0), child: Icon( Icons.add, color: DesignCourseAppTheme .nearlyWhite, ), ), ) ], ), ), ], ), ), ), ], ), ), ) ], ), ), Container( child: Padding( padding: const EdgeInsets.only( top: 24, bottom: 24, left: 16), child: Row( children: <Widget>[ ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(16.0)), child: AspectRatio( aspectRatio: 1.0, child: Image.asset(category.imagePath)), ) ], ), ), ), ], ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/design_course/course_info_screen.dart
import 'package:flutter/material.dart'; import 'design_course_app_theme.dart'; class CourseInfoScreen extends StatefulWidget { @override _CourseInfoScreenState createState() => _CourseInfoScreenState(); } class _CourseInfoScreenState extends State<CourseInfoScreen> with TickerProviderStateMixin { final double infoHeight = 364.0; AnimationController animationController; Animation<double> animation; double opacity1 = 0.0; double opacity2 = 0.0; double opacity3 = 0.0; @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 1000), vsync: this); animation = Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: animationController, curve: Interval(0, 1.0, curve: Curves.fastOutSlowIn))); setData(); super.initState(); } Future<void> setData() async { animationController.forward(); await Future<dynamic>.delayed(const Duration(milliseconds: 200)); setState(() { opacity1 = 1.0; }); await Future<dynamic>.delayed(const Duration(milliseconds: 200)); setState(() { opacity2 = 1.0; }); await Future<dynamic>.delayed(const Duration(milliseconds: 200)); setState(() { opacity3 = 1.0; }); } @override Widget build(BuildContext context) { final double tempHeight = MediaQuery.of(context).size.height - (MediaQuery.of(context).size.width / 1.2) + 24.0; return Container( color: DesignCourseAppTheme.nearlyWhite, child: Scaffold( backgroundColor: Colors.transparent, body: Stack( children: <Widget>[ Column( children: <Widget>[ AspectRatio( aspectRatio: 1.2, child: Image.asset('assets/design_course/webInterFace.png'), ), ], ), Positioned( top: (MediaQuery.of(context).size.width / 1.2) - 24.0, bottom: 0, left: 0, right: 0, child: Container( decoration: BoxDecoration( color: DesignCourseAppTheme.nearlyWhite, borderRadius: const BorderRadius.only( topLeft: Radius.circular(32.0), topRight: Radius.circular(32.0)), boxShadow: <BoxShadow>[ BoxShadow( color: DesignCourseAppTheme.grey.withOpacity(0.2), offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Padding( padding: const EdgeInsets.only(left: 8, right: 8), child: SingleChildScrollView( child: Container( constraints: BoxConstraints( minHeight: infoHeight, maxHeight: tempHeight > infoHeight ? tempHeight : infoHeight), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only( top: 32.0, left: 18, right: 16), child: Text( 'Web Design\nCourse', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 22, letterSpacing: 0.27, color: DesignCourseAppTheme.darkerText, ), ), ), Padding( padding: const EdgeInsets.only( left: 16, right: 16, bottom: 8, top: 16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( '\$28.99', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 22, letterSpacing: 0.27, color: DesignCourseAppTheme.nearlyBlue, ), ), Container( child: Row( children: <Widget>[ Text( '4.3', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 22, letterSpacing: 0.27, color: DesignCourseAppTheme.grey, ), ), Icon( Icons.star, color: DesignCourseAppTheme.nearlyBlue, size: 24, ), ], ), ) ], ), ), AnimatedOpacity( duration: const Duration(milliseconds: 500), opacity: opacity1, child: Padding( padding: const EdgeInsets.all(8), child: Row( children: <Widget>[ getTimeBoxUI('24', 'Classe'), getTimeBoxUI('2hours', 'Time'), getTimeBoxUI('24', 'Seat'), ], ), ), ), Expanded( child: AnimatedOpacity( duration: const Duration(milliseconds: 500), opacity: opacity2, child: Padding( padding: const EdgeInsets.only( left: 16, right: 16, top: 8, bottom: 8), child: Text( 'Lorem ipsum is simply dummy text of printing & typesetting industry, Lorem ipsum is simply dummy text of printing & typesetting industry.', textAlign: TextAlign.justify, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 14, letterSpacing: 0.27, color: DesignCourseAppTheme.grey, ), maxLines: 3, overflow: TextOverflow.ellipsis, ), ), ), ), AnimatedOpacity( duration: const Duration(milliseconds: 500), opacity: opacity3, child: Padding( padding: const EdgeInsets.only( left: 16, bottom: 16, right: 16), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Container( width: 48, height: 48, child: Container( decoration: BoxDecoration( color: DesignCourseAppTheme.nearlyWhite, borderRadius: const BorderRadius.all( Radius.circular(16.0), ), border: Border.all( color: DesignCourseAppTheme.grey .withOpacity(0.2)), ), child: Icon( Icons.add, color: DesignCourseAppTheme.nearlyBlue, size: 28, ), ), ), const SizedBox( width: 16, ), Expanded( child: Container( height: 48, decoration: BoxDecoration( color: DesignCourseAppTheme.nearlyBlue, borderRadius: const BorderRadius.all( Radius.circular(16.0), ), boxShadow: <BoxShadow>[ BoxShadow( color: DesignCourseAppTheme .nearlyBlue .withOpacity(0.5), offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Center( child: Text( 'Join Course', textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 18, letterSpacing: 0.0, color: DesignCourseAppTheme .nearlyWhite, ), ), ), ), ) ], ), ), ), SizedBox( height: MediaQuery.of(context).padding.bottom, ) ], ), ), ), ), ), ), Positioned( top: (MediaQuery.of(context).size.width / 1.2) - 24.0 - 35, right: 35, child: ScaleTransition( alignment: Alignment.center, scale: CurvedAnimation( parent: animationController, curve: Curves.fastOutSlowIn), child: Card( color: DesignCourseAppTheme.nearlyBlue, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(50.0)), elevation: 10.0, child: Container( width: 60, height: 60, child: Center( child: Icon( Icons.favorite, color: DesignCourseAppTheme.nearlyWhite, size: 30, ), ), ), ), ), ), Padding( padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: SizedBox( width: AppBar().preferredSize.height, height: AppBar().preferredSize.height, child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(AppBar().preferredSize.height), child: Icon( Icons.arrow_back_ios, color: DesignCourseAppTheme.nearlyBlack, ), onTap: () { Navigator.pop(context); }, ), ), ), ) ], ), ), ); } Widget getTimeBoxUI(String text1, String txt2) { return Padding( padding: const EdgeInsets.all(8.0), child: Container( decoration: BoxDecoration( color: DesignCourseAppTheme.nearlyWhite, borderRadius: const BorderRadius.all(Radius.circular(16.0)), boxShadow: <BoxShadow>[ BoxShadow( color: DesignCourseAppTheme.grey.withOpacity(0.2), offset: const Offset(1.1, 1.1), blurRadius: 8.0), ], ), child: Padding( padding: const EdgeInsets.only( left: 18.0, right: 18.0, top: 12.0, bottom: 12.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( text1, textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: 0.27, color: DesignCourseAppTheme.nearlyBlue, ), ), Text( txt2, textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.w200, fontSize: 14, letterSpacing: 0.27, color: DesignCourseAppTheme.grey, ), ), ], ), ), ), ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/design_course
mirrored_repositories/best_flutter_ui_templates/lib/design_course/models/category.dart
class Category { Category({ this.title = '', this.imagePath = '', this.lessonCount = 0, this.money = 0, this.rating = 0.0, }); String title; int lessonCount; int money; double rating; String imagePath; static List<Category> categoryList = <Category>[ Category( imagePath: 'assets/design_course/interFace1.png', title: 'User interface Design', lessonCount: 24, money: 25, rating: 4.3, ), Category( imagePath: 'assets/design_course/interFace2.png', title: 'User interface Design', lessonCount: 22, money: 18, rating: 4.6, ), Category( imagePath: 'assets/design_course/interFace1.png', title: 'User interface Design', lessonCount: 24, money: 25, rating: 4.3, ), Category( imagePath: 'assets/design_course/interFace2.png', title: 'User interface Design', lessonCount: 22, money: 18, rating: 4.6, ), ]; static List<Category> popularCourseList = <Category>[ Category( imagePath: 'assets/design_course/interFace3.png', title: 'App Design Course', lessonCount: 12, money: 25, rating: 4.8, ), Category( imagePath: 'assets/design_course/interFace4.png', title: 'Web Design Course', lessonCount: 28, money: 208, rating: 4.9, ), Category( imagePath: 'assets/design_course/interFace3.png', title: 'App Design Course', lessonCount: 12, money: 25, rating: 4.8, ), Category( imagePath: 'assets/design_course/interFace4.png', title: 'Web Design Course', lessonCount: 28, money: 208, rating: 4.9, ), ]; }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/fintness_app_theme.dart
import 'package:flutter/material.dart'; class FitnessAppTheme { FitnessAppTheme._(); static const Color nearlyWhite = Color(0xFFFAFAFA); static const Color white = Color(0xFFFFFFFF); static const Color background = Color(0xFFF2F3F8); static const Color nearlyDarkBlue = Color(0xFF2633C5); static const Color nearlyBlue = Color(0xFF00B6F0); static const Color nearlyBlack = Color(0xFF213333); static const Color grey = Color(0xFF3A5160); static const Color dark_grey = Color(0xFF313A44); static const Color darkText = Color(0xFF253840); static const Color darkerText = Color(0xFF17262A); static const Color lightText = Color(0xFF4A6572); static const Color deactivatedText = Color(0xFF767676); static const Color dismissibleBackground = Color(0xFF364A54); static const Color spacer = Color(0xFFF2F2F2); static const String fontName = 'Roboto'; static const TextTheme textTheme = TextTheme( headline4: display1, headline5: headline, headline6: title, subtitle2: subtitle, bodyText2: body2, bodyText1: body1, caption: caption, ); static const TextStyle display1 = TextStyle( fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 36, letterSpacing: 0.4, height: 0.9, color: darkerText, ); static const TextStyle headline = TextStyle( fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 24, letterSpacing: 0.27, color: darkerText, ); static const TextStyle title = TextStyle( fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 16, letterSpacing: 0.18, color: darkerText, ); static const TextStyle subtitle = TextStyle( fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 14, letterSpacing: -0.04, color: darkText, ); static const TextStyle body2 = TextStyle( fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 14, letterSpacing: 0.2, color: darkText, ); static const TextStyle body1 = TextStyle( fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 16, letterSpacing: -0.05, color: darkText, ); static const TextStyle caption = TextStyle( fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 12, letterSpacing: 0.2, color: lightText, // was lightText ); }
0
mirrored_repositories/best_flutter_ui_templates/lib
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/fitness_app_home_screen.dart
import 'package:best_flutter_ui_templates/fitness_app/models/tabIcon_data.dart'; import 'package:best_flutter_ui_templates/fitness_app/traning/training_screen.dart'; import 'package:flutter/material.dart'; import 'bottom_navigation_view/bottom_bar_view.dart'; import 'fintness_app_theme.dart'; import 'my_diary/my_diary_screen.dart'; class FitnessAppHomeScreen extends StatefulWidget { @override _FitnessAppHomeScreenState createState() => _FitnessAppHomeScreenState(); } class _FitnessAppHomeScreenState extends State<FitnessAppHomeScreen> with TickerProviderStateMixin { AnimationController animationController; List<TabIconData> tabIconsList = TabIconData.tabIconsList; Widget tabBody = Container( color: FitnessAppTheme.background, ); @override void initState() { tabIconsList.forEach((TabIconData tab) { tab.isSelected = false; }); tabIconsList[0].isSelected = true; animationController = AnimationController( duration: const Duration(milliseconds: 600), vsync: this); tabBody = MyDiaryScreen(animationController: animationController); super.initState(); } @override void dispose() { animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Container( color: FitnessAppTheme.background, child: Scaffold( backgroundColor: Colors.transparent, body: FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return Stack( children: <Widget>[ tabBody, bottomBar(), ], ); } }, ), ), ); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 200)); return true; } Widget bottomBar() { return Column( children: <Widget>[ const Expanded( child: SizedBox(), ), BottomBarView( tabIconsList: tabIconsList, addClick: () {}, changeIndex: (int index) { if (index == 0 || index == 2) { animationController.reverse().then<dynamic>((data) { if (!mounted) { return; } setState(() { tabBody = MyDiaryScreen(animationController: animationController); }); }); } else if (index == 1 || index == 3) { animationController.reverse().then<dynamic>((data) { if (!mounted) { return; } setState(() { tabBody = TrainingScreen(animationController: animationController); }); }); } }, ), ], ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/my_diary/meals_list_view.dart
import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:best_flutter_ui_templates/fitness_app/models/meals_list_data.dart'; import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; import '../../main.dart'; class MealsListView extends StatefulWidget { const MealsListView( {Key key, this.mainScreenAnimationController, this.mainScreenAnimation}) : super(key: key); final AnimationController mainScreenAnimationController; final Animation<dynamic> mainScreenAnimation; @override _MealsListViewState createState() => _MealsListViewState(); } class _MealsListViewState extends State<MealsListView> with TickerProviderStateMixin { AnimationController animationController; List<MealsListData> mealsListData = MealsListData.tabIconsList; @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 2000), vsync: this); super.initState(); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 50)); return true; } @override void dispose() { animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return AnimatedBuilder( animation: widget.mainScreenAnimationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: widget.mainScreenAnimation, child: Transform( transform: Matrix4.translationValues( 0.0, 30 * (1.0 - widget.mainScreenAnimation.value), 0.0), child: Container( height: 216, width: double.infinity, child: ListView.builder( padding: const EdgeInsets.only( top: 0, bottom: 0, right: 16, left: 16), itemCount: mealsListData.length, scrollDirection: Axis.horizontal, itemBuilder: (BuildContext context, int index) { final int count = mealsListData.length > 10 ? 10 : mealsListData.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval((1 / count) * index, 1.0, curve: Curves.fastOutSlowIn))); animationController.forward(); return MealsView( mealsListData: mealsListData[index], animation: animation, animationController: animationController, ); }, ), ), ), ); }, ); } } class MealsView extends StatelessWidget { const MealsView( {Key key, this.mealsListData, this.animationController, this.animation}) : super(key: key); final MealsListData mealsListData; final AnimationController animationController; final Animation<dynamic> animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: Transform( transform: Matrix4.translationValues( 100 * (1.0 - animation.value), 0.0, 0.0), child: SizedBox( width: 130, child: Stack( children: <Widget>[ Padding( padding: const EdgeInsets.only( top: 32, left: 8, right: 8, bottom: 16), child: Container( decoration: BoxDecoration( boxShadow: <BoxShadow>[ BoxShadow( color: HexColor(mealsListData.endColor) .withOpacity(0.6), offset: const Offset(1.1, 4.0), blurRadius: 8.0), ], gradient: LinearGradient( colors: <HexColor>[ HexColor(mealsListData.startColor), HexColor(mealsListData.endColor), ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: const BorderRadius.only( bottomRight: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), topLeft: Radius.circular(8.0), topRight: Radius.circular(54.0), ), ), child: Padding( padding: const EdgeInsets.only( top: 54, left: 16, right: 16, bottom: 8), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( mealsListData.titleTxt, textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.bold, fontSize: 16, letterSpacing: 0.2, color: FitnessAppTheme.white, ), ), Expanded( child: Padding( padding: const EdgeInsets.only(top: 8, bottom: 8), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( mealsListData.meals.join('\n'), style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 10, letterSpacing: 0.2, color: FitnessAppTheme.white, ), ), ], ), ), ), mealsListData.kacl != 0 ? Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Text( mealsListData.kacl.toString(), textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 24, letterSpacing: 0.2, color: FitnessAppTheme.white, ), ), Padding( padding: const EdgeInsets.only( left: 4, bottom: 3), child: Text( 'kcal', style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 10, letterSpacing: 0.2, color: FitnessAppTheme.white, ), ), ), ], ) : Container( decoration: BoxDecoration( color: FitnessAppTheme.nearlyWhite, shape: BoxShape.circle, boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.nearlyBlack .withOpacity(0.4), offset: Offset(8.0, 8.0), blurRadius: 8.0), ], ), child: Padding( padding: const EdgeInsets.all(6.0), child: Icon( Icons.add, color: HexColor(mealsListData.endColor), size: 24, ), ), ), ], ), ), ), ), Positioned( top: 0, left: 0, child: Container( width: 84, height: 84, decoration: BoxDecoration( color: FitnessAppTheme.nearlyWhite.withOpacity(0.2), shape: BoxShape.circle, ), ), ), Positioned( top: 0, left: 8, child: SizedBox( width: 80, height: 80, child: Image.asset(mealsListData.imagePath), ), ) ], ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/my_diary/my_diary_screen.dart
import 'package:best_flutter_ui_templates/fitness_app/ui_view/body_measurement.dart'; import 'package:best_flutter_ui_templates/fitness_app/ui_view/glass_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/ui_view/mediterranesn_diet_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/ui_view/title_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:best_flutter_ui_templates/fitness_app/my_diary/meals_list_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/my_diary/water_view.dart'; import 'package:flutter/material.dart'; class MyDiaryScreen extends StatefulWidget { const MyDiaryScreen({Key key, this.animationController}) : super(key: key); final AnimationController animationController; @override _MyDiaryScreenState createState() => _MyDiaryScreenState(); } class _MyDiaryScreenState extends State<MyDiaryScreen> with TickerProviderStateMixin { Animation<double> topBarAnimation; List<Widget> listViews = <Widget>[]; final ScrollController scrollController = ScrollController(); double topBarOpacity = 0.0; @override void initState() { topBarAnimation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, curve: Interval(0, 0.5, curve: Curves.fastOutSlowIn))); addAllListData(); scrollController.addListener(() { if (scrollController.offset >= 24) { if (topBarOpacity != 1.0) { setState(() { topBarOpacity = 1.0; }); } } else if (scrollController.offset <= 24 && scrollController.offset >= 0) { if (topBarOpacity != scrollController.offset / 24) { setState(() { topBarOpacity = scrollController.offset / 24; }); } } else if (scrollController.offset <= 0) { if (topBarOpacity != 0.0) { setState(() { topBarOpacity = 0.0; }); } } }); super.initState(); } void addAllListData() { const int count = 9; listViews.add( TitleView( titleTxt: 'Mediterranean diet', subTxt: 'Details', animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 0, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( MediterranesnDietView( animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 1, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( TitleView( titleTxt: 'Meals today', subTxt: 'Customize', animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 2, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( MealsListView( mainScreenAnimation: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 3, 1.0, curve: Curves.fastOutSlowIn))), mainScreenAnimationController: widget.animationController, ), ); listViews.add( TitleView( titleTxt: 'Body measurement', subTxt: 'Today', animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 4, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( BodyMeasurementView( animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 5, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( TitleView( titleTxt: 'Water', subTxt: 'Aqua SmartBottle', animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 6, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( WaterView( mainScreenAnimation: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 7, 1.0, curve: Curves.fastOutSlowIn))), mainScreenAnimationController: widget.animationController, ), ); listViews.add( GlassView( animation: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 8, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController), ); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 50)); return true; } @override Widget build(BuildContext context) { return Container( color: FitnessAppTheme.background, child: Scaffold( backgroundColor: Colors.transparent, body: Stack( children: <Widget>[ getMainListViewUI(), getAppBarUI(), SizedBox( height: MediaQuery.of(context).padding.bottom, ) ], ), ), ); } Widget getMainListViewUI() { return FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return ListView.builder( controller: scrollController, padding: EdgeInsets.only( top: AppBar().preferredSize.height + MediaQuery.of(context).padding.top + 24, bottom: 62 + MediaQuery.of(context).padding.bottom, ), itemCount: listViews.length, scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) { widget.animationController.forward(); return listViews[index]; }, ); } }, ); } Widget getAppBarUI() { return Column( children: <Widget>[ AnimatedBuilder( animation: widget.animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: topBarAnimation, child: Transform( transform: Matrix4.translationValues( 0.0, 30 * (1.0 - topBarAnimation.value), 0.0), child: Container( decoration: BoxDecoration( color: FitnessAppTheme.white.withOpacity(topBarOpacity), borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(32.0), ), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey .withOpacity(0.4 * topBarOpacity), offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Column( children: <Widget>[ SizedBox( height: MediaQuery.of(context).padding.top, ), Padding( padding: EdgeInsets.only( left: 16, right: 16, top: 16 - 8.0 * topBarOpacity, bottom: 12 - 8.0 * topBarOpacity), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Expanded( child: Padding( padding: const EdgeInsets.all(8.0), child: Text( 'My Diary', textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w700, fontSize: 22 + 6 - 6 * topBarOpacity, letterSpacing: 1.2, color: FitnessAppTheme.darkerText, ), ), ), ), SizedBox( height: 38, width: 38, child: InkWell( highlightColor: Colors.transparent, borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, child: Center( child: Icon( Icons.keyboard_arrow_left, color: FitnessAppTheme.grey, ), ), ), ), Padding( padding: const EdgeInsets.only( left: 8, right: 8, ), child: Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(right: 8), child: Icon( Icons.calendar_today, color: FitnessAppTheme.grey, size: 18, ), ), Text( '15 May', textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 18, letterSpacing: -0.2, color: FitnessAppTheme.darkerText, ), ), ], ), ), SizedBox( height: 38, width: 38, child: InkWell( highlightColor: Colors.transparent, borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, child: Center( child: Icon( Icons.keyboard_arrow_right, color: FitnessAppTheme.grey, ), ), ), ), ], ), ) ], ), ), ), ); }, ) ], ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/my_diary/water_view.dart
import 'package:best_flutter_ui_templates/fitness_app/ui_view/wave_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; class WaterView extends StatefulWidget { const WaterView( {Key key, this.mainScreenAnimationController, this.mainScreenAnimation}) : super(key: key); final AnimationController mainScreenAnimationController; final Animation<dynamic> mainScreenAnimation; @override _WaterViewState createState() => _WaterViewState(); } class _WaterViewState extends State<WaterView> with TickerProviderStateMixin { Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 50)); return true; } @override Widget build(BuildContext context) { return AnimatedBuilder( animation: widget.mainScreenAnimationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: widget.mainScreenAnimation, child: Transform( transform: Matrix4.translationValues( 0.0, 30 * (1.0 - widget.mainScreenAnimation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( color: FitnessAppTheme.white, borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey.withOpacity(0.2), offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Padding( padding: const EdgeInsets.only( top: 16, left: 16, right: 16, bottom: 16), child: Row( children: <Widget>[ Expanded( child: Column( children: <Widget>[ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 4, bottom: 3), child: Text( '2100', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 32, color: FitnessAppTheme.nearlyDarkBlue, ), ), ), Padding( padding: const EdgeInsets.only( left: 8, bottom: 8), child: Text( 'ml', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 18, letterSpacing: -0.2, color: FitnessAppTheme.nearlyDarkBlue, ), ), ), ], ), Padding( padding: const EdgeInsets.only( left: 4, top: 2, bottom: 14), child: Text( 'of daily goal 3.5L', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.darkText, ), ), ), ], ), Padding( padding: const EdgeInsets.only( left: 4, right: 4, top: 8, bottom: 16), child: Container( height: 2, decoration: BoxDecoration( color: FitnessAppTheme.background, borderRadius: const BorderRadius.all( Radius.circular(4.0)), ), ), ), Padding( padding: const EdgeInsets.only(top: 16), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 4), child: Icon( Icons.access_time, color: FitnessAppTheme.grey .withOpacity(0.5), size: 16, ), ), Padding( padding: const EdgeInsets.only(left: 4.0), child: Text( 'Last drink 8:26 AM', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), Padding( padding: const EdgeInsets.only(top: 4), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ SizedBox( width: 24, height: 24, child: Image.asset( 'assets/fitness_app/bell.png'), ), Flexible( child: Text( 'Your bottle is empty, refill it!.', textAlign: TextAlign.start, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 12, letterSpacing: 0.0, color: HexColor('#F65283'), ), ), ), ], ), ), ], ), ) ], ), ), SizedBox( width: 34, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Container( decoration: BoxDecoration( color: FitnessAppTheme.nearlyWhite, shape: BoxShape.circle, boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.nearlyDarkBlue .withOpacity(0.4), offset: const Offset(4.0, 4.0), blurRadius: 8.0), ], ), child: Padding( padding: const EdgeInsets.all(6.0), child: Icon( Icons.add, color: FitnessAppTheme.nearlyDarkBlue, size: 24, ), ), ), const SizedBox( height: 28, ), Container( decoration: BoxDecoration( color: FitnessAppTheme.nearlyWhite, shape: BoxShape.circle, boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.nearlyDarkBlue .withOpacity(0.4), offset: const Offset(4.0, 4.0), blurRadius: 8.0), ], ), child: Padding( padding: const EdgeInsets.all(6.0), child: Icon( Icons.remove, color: FitnessAppTheme.nearlyDarkBlue, size: 24, ), ), ), ], ), ), Padding( padding: const EdgeInsets.only(left: 16, right: 8, top: 16), child: Container( width: 60, height: 160, decoration: BoxDecoration( color: HexColor('#E8EDFE'), borderRadius: const BorderRadius.only( topLeft: Radius.circular(80.0), bottomLeft: Radius.circular(80.0), bottomRight: Radius.circular(80.0), topRight: Radius.circular(80.0)), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey.withOpacity(0.4), offset: const Offset(2, 2), blurRadius: 4), ], ), child: WaveView( percentageValue: 60.0, ), ), ) ], ), ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/models/meals_list_data.dart
class MealsListData { MealsListData({ this.imagePath = '', this.titleTxt = '', this.startColor = '', this.endColor = '', this.meals, this.kacl = 0, }); String imagePath; String titleTxt; String startColor; String endColor; List<String> meals; int kacl; static List<MealsListData> tabIconsList = <MealsListData>[ MealsListData( imagePath: 'assets/fitness_app/breakfast.png', titleTxt: 'Breakfast', kacl: 525, meals: <String>['Bread,', 'Peanut butter,', 'Apple'], startColor: '#FA7D82', endColor: '#FFB295', ), MealsListData( imagePath: 'assets/fitness_app/lunch.png', titleTxt: 'Lunch', kacl: 602, meals: <String>['Salmon,', 'Mixed veggies,', 'Avocado'], startColor: '#738AE6', endColor: '#5C5EDD', ), MealsListData( imagePath: 'assets/fitness_app/snack.png', titleTxt: 'Snack', kacl: 0, meals: <String>['Recommend:', '800 kcal'], startColor: '#FE95B6', endColor: '#FF5287', ), MealsListData( imagePath: 'assets/fitness_app/dinner.png', titleTxt: 'Dinner', kacl: 0, meals: <String>['Recommend:', '703 kcal'], startColor: '#6F72CA', endColor: '#1E1466', ), ]; }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/models/tabIcon_data.dart
import 'package:flutter/material.dart'; class TabIconData { TabIconData({ this.imagePath = '', this.index = 0, this.selectedImagePath = '', this.isSelected = false, this.animationController, }); String imagePath; String selectedImagePath; bool isSelected; int index; AnimationController animationController; static List<TabIconData> tabIconsList = <TabIconData>[ TabIconData( imagePath: 'assets/fitness_app/tab_1.png', selectedImagePath: 'assets/fitness_app/tab_1s.png', index: 0, isSelected: true, animationController: null, ), TabIconData( imagePath: 'assets/fitness_app/tab_2.png', selectedImagePath: 'assets/fitness_app/tab_2s.png', index: 1, isSelected: false, animationController: null, ), TabIconData( imagePath: 'assets/fitness_app/tab_3.png', selectedImagePath: 'assets/fitness_app/tab_3s.png', index: 2, isSelected: false, animationController: null, ), TabIconData( imagePath: 'assets/fitness_app/tab_4.png', selectedImagePath: 'assets/fitness_app/tab_4s.png', index: 3, isSelected: false, animationController: null, ), ]; }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/traning/training_screen.dart
import 'package:best_flutter_ui_templates/fitness_app/ui_view/area_list_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/ui_view/running_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/ui_view/title_view.dart'; import 'package:best_flutter_ui_templates/fitness_app/ui_view/workout_view.dart'; import 'package:flutter/material.dart'; import '../fintness_app_theme.dart'; class TrainingScreen extends StatefulWidget { const TrainingScreen({Key key, this.animationController}) : super(key: key); final AnimationController animationController; @override _TrainingScreenState createState() => _TrainingScreenState(); } class _TrainingScreenState extends State<TrainingScreen> with TickerProviderStateMixin { Animation<double> topBarAnimation; List<Widget> listViews = <Widget>[]; final ScrollController scrollController = ScrollController(); double topBarOpacity = 0.0; @override void initState() { topBarAnimation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, curve: Interval(0, 0.5, curve: Curves.fastOutSlowIn))); addAllListData(); scrollController.addListener(() { if (scrollController.offset >= 24) { if (topBarOpacity != 1.0) { setState(() { topBarOpacity = 1.0; }); } } else if (scrollController.offset <= 24 && scrollController.offset >= 0) { if (topBarOpacity != scrollController.offset / 24) { setState(() { topBarOpacity = scrollController.offset / 24; }); } } else if (scrollController.offset <= 0) { if (topBarOpacity != 0.0) { setState(() { topBarOpacity = 0.0; }); } } }); super.initState(); } void addAllListData() { const int count = 5; listViews.add( TitleView( titleTxt: 'Your program', subTxt: 'Details', animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 0, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( WorkoutView( animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 2, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( RunningView( animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 3, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( TitleView( titleTxt: 'Area of focus', subTxt: 'more', animation: Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 4, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); listViews.add( AreaListView( mainScreenAnimation: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, curve: Interval((1 / count) * 5, 1.0, curve: Curves.fastOutSlowIn))), mainScreenAnimationController: widget.animationController, ), ); } Future<bool> getData() async { await Future<dynamic>.delayed(const Duration(milliseconds: 50)); return true; } @override Widget build(BuildContext context) { return Container( color: FitnessAppTheme.background, child: Scaffold( backgroundColor: Colors.transparent, body: Stack( children: <Widget>[ getMainListViewUI(), getAppBarUI(), SizedBox( height: MediaQuery.of(context).padding.bottom, ) ], ), ), ); } Widget getMainListViewUI() { return FutureBuilder<bool>( future: getData(), builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { if (!snapshot.hasData) { return const SizedBox(); } else { return ListView.builder( controller: scrollController, padding: EdgeInsets.only( top: AppBar().preferredSize.height + MediaQuery.of(context).padding.top + 24, bottom: 62 + MediaQuery.of(context).padding.bottom, ), itemCount: listViews.length, scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) { widget.animationController.forward(); return listViews[index]; }, ); } }, ); } Widget getAppBarUI() { return Column( children: <Widget>[ AnimatedBuilder( animation: widget.animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: topBarAnimation, child: Transform( transform: Matrix4.translationValues( 0.0, 30 * (1.0 - topBarAnimation.value), 0.0), child: Container( decoration: BoxDecoration( color: FitnessAppTheme.white.withOpacity(topBarOpacity), borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(32.0), ), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey .withOpacity(0.4 * topBarOpacity), offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Column( children: <Widget>[ SizedBox( height: MediaQuery.of(context).padding.top, ), Padding( padding: EdgeInsets.only( left: 16, right: 16, top: 16 - 8.0 * topBarOpacity, bottom: 12 - 8.0 * topBarOpacity), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Expanded( child: Padding( padding: const EdgeInsets.all(8.0), child: Text( 'Training', textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w700, fontSize: 22 + 6 - 6 * topBarOpacity, letterSpacing: 1.2, color: FitnessAppTheme.darkerText, ), ), ), ), SizedBox( height: 38, width: 38, child: InkWell( highlightColor: Colors.transparent, borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, child: Center( child: Icon( Icons.keyboard_arrow_left, color: FitnessAppTheme.grey, ), ), ), ), Padding( padding: const EdgeInsets.only( left: 8, right: 8, ), child: Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(right: 8), child: Icon( Icons.calendar_today, color: FitnessAppTheme.grey, size: 18, ), ), Text( '15 May', textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 18, letterSpacing: -0.2, color: FitnessAppTheme.darkerText, ), ), ], ), ), SizedBox( height: 38, width: 38, child: InkWell( highlightColor: Colors.transparent, borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, child: Center( child: Icon( Icons.keyboard_arrow_right, color: FitnessAppTheme.grey, ), ), ), ), ], ), ) ], ), ), ), ); }, ) ], ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/bottom_navigation_view/bottom_bar_view.dart
import 'dart:math' as math; import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:best_flutter_ui_templates/fitness_app/models/tabIcon_data.dart'; import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; import '../../main.dart'; import '../models/tabIcon_data.dart'; class BottomBarView extends StatefulWidget { const BottomBarView( {Key key, this.tabIconsList, this.changeIndex, this.addClick}) : super(key: key); final Function(int index) changeIndex; final Function addClick; final List<TabIconData> tabIconsList; @override _BottomBarViewState createState() => _BottomBarViewState(); } class _BottomBarViewState extends State<BottomBarView> with TickerProviderStateMixin { AnimationController animationController; @override void initState() { animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 1000), ); animationController.forward(); super.initState(); } @override Widget build(BuildContext context) { return Stack( alignment: AlignmentDirectional.bottomCenter, children: <Widget>[ AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return Transform( transform: Matrix4.translationValues(0.0, 0.0, 0.0), child: PhysicalShape( color: FitnessAppTheme.white, elevation: 16.0, clipper: TabClipper( radius: Tween<double>(begin: 0.0, end: 1.0) .animate(CurvedAnimation( parent: animationController, curve: Curves.fastOutSlowIn)) .value * 38.0), child: Column( children: <Widget>[ SizedBox( height: 62, child: Padding( padding: const EdgeInsets.only(left: 8, right: 8, top: 4), child: Row( children: <Widget>[ Expanded( child: TabIcons( tabIconData: widget.tabIconsList[0], removeAllSelect: () { setRemoveAllSelection( widget.tabIconsList[0]); widget.changeIndex(0); }), ), Expanded( child: TabIcons( tabIconData: widget.tabIconsList[1], removeAllSelect: () { setRemoveAllSelection( widget.tabIconsList[1]); widget.changeIndex(1); }), ), SizedBox( width: Tween<double>(begin: 0.0, end: 1.0) .animate(CurvedAnimation( parent: animationController, curve: Curves.fastOutSlowIn)) .value * 64.0, ), Expanded( child: TabIcons( tabIconData: widget.tabIconsList[2], removeAllSelect: () { setRemoveAllSelection( widget.tabIconsList[2]); widget.changeIndex(2); }), ), Expanded( child: TabIcons( tabIconData: widget.tabIconsList[3], removeAllSelect: () { setRemoveAllSelection( widget.tabIconsList[3]); widget.changeIndex(3); }), ), ], ), ), ), SizedBox( height: MediaQuery.of(context).padding.bottom, ) ], ), ), ); }, ), Padding( padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom), child: SizedBox( width: 38 * 2.0, height: 38 + 62.0, child: Container( alignment: Alignment.topCenter, color: Colors.transparent, child: SizedBox( width: 38 * 2.0, height: 38 * 2.0, child: Padding( padding: const EdgeInsets.all(8.0), child: ScaleTransition( alignment: Alignment.center, scale: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Curves.fastOutSlowIn)), child: Container( // alignment: Alignment.center,s decoration: BoxDecoration( color: FitnessAppTheme.nearlyDarkBlue, gradient: LinearGradient( colors: [ FitnessAppTheme.nearlyDarkBlue, HexColor('#6A88E5'), ], begin: Alignment.topLeft, end: Alignment.bottomRight), shape: BoxShape.circle, boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.nearlyDarkBlue .withOpacity(0.4), offset: const Offset(8.0, 16.0), blurRadius: 16.0), ], ), child: Material( color: Colors.transparent, child: InkWell( splashColor: Colors.white.withOpacity(0.1), highlightColor: Colors.transparent, focusColor: Colors.transparent, onTap: () { widget.addClick(); }, child: Icon( Icons.add, color: FitnessAppTheme.white, size: 32, ), ), ), ), ), ), ), ), ), ), ], ); } void setRemoveAllSelection(TabIconData tabIconData) { if (!mounted) return; setState(() { widget.tabIconsList.forEach((TabIconData tab) { tab.isSelected = false; if (tabIconData.index == tab.index) { tab.isSelected = true; } }); }); } } class TabIcons extends StatefulWidget { const TabIcons({Key key, this.tabIconData, this.removeAllSelect}) : super(key: key); final TabIconData tabIconData; final Function removeAllSelect; @override _TabIconsState createState() => _TabIconsState(); } class _TabIconsState extends State<TabIcons> with TickerProviderStateMixin { @override void initState() { widget.tabIconData.animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 400), )..addStatusListener((AnimationStatus status) { if (status == AnimationStatus.completed) { if (!mounted) return; widget.removeAllSelect(); widget.tabIconData.animationController.reverse(); } }); super.initState(); } void setAnimation() { widget.tabIconData.animationController.forward(); } @override Widget build(BuildContext context) { return AspectRatio( aspectRatio: 1, child: Center( child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, onTap: () { if (!widget.tabIconData.isSelected) { setAnimation(); } }, child: IgnorePointer( child: Stack( alignment: AlignmentDirectional.center, children: <Widget>[ ScaleTransition( alignment: Alignment.center, scale: Tween<double>(begin: 0.88, end: 1.0).animate( CurvedAnimation( parent: widget.tabIconData.animationController, curve: Interval(0.1, 1.0, curve: Curves.fastOutSlowIn))), child: Image.asset(widget.tabIconData.isSelected ? widget.tabIconData.selectedImagePath : widget.tabIconData.imagePath), ), Positioned( top: 4, left: 6, right: 0, child: ScaleTransition( alignment: Alignment.center, scale: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.tabIconData.animationController, curve: Interval(0.2, 1.0, curve: Curves.fastOutSlowIn))), child: Container( width: 8, height: 8, decoration: BoxDecoration( color: FitnessAppTheme.nearlyDarkBlue, shape: BoxShape.circle, ), ), ), ), Positioned( top: 0, left: 6, bottom: 8, child: ScaleTransition( alignment: Alignment.center, scale: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.tabIconData.animationController, curve: Interval(0.5, 0.8, curve: Curves.fastOutSlowIn))), child: Container( width: 4, height: 4, decoration: BoxDecoration( color: FitnessAppTheme.nearlyDarkBlue, shape: BoxShape.circle, ), ), ), ), Positioned( top: 6, right: 8, bottom: 0, child: ScaleTransition( alignment: Alignment.center, scale: Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.tabIconData.animationController, curve: Interval(0.5, 0.6, curve: Curves.fastOutSlowIn))), child: Container( width: 6, height: 6, decoration: BoxDecoration( color: FitnessAppTheme.nearlyDarkBlue, shape: BoxShape.circle, ), ), ), ), ], ), ), ), ), ); } } class TabClipper extends CustomClipper<Path> { TabClipper({this.radius = 38.0}); final double radius; @override Path getClip(Size size) { final Path path = Path(); final double v = radius * 2; path.lineTo(0, 0); path.arcTo(Rect.fromLTWH(0, 0, radius, radius), degreeToRadians(180), degreeToRadians(90), false); path.arcTo( Rect.fromLTWH( ((size.width / 2) - v / 2) - radius + v * 0.04, 0, radius, radius), degreeToRadians(270), degreeToRadians(70), false); path.arcTo(Rect.fromLTWH((size.width / 2) - v / 2, -v / 2, v, v), degreeToRadians(160), degreeToRadians(-140), false); path.arcTo( Rect.fromLTWH((size.width - ((size.width / 2) - v / 2)) - v * 0.04, 0, radius, radius), degreeToRadians(200), degreeToRadians(70), false); path.arcTo(Rect.fromLTWH(size.width - radius, 0, radius, radius), degreeToRadians(270), degreeToRadians(90), false); path.lineTo(size.width, 0); path.lineTo(size.width, size.height); path.lineTo(0, size.height); path.close(); return path; } @override bool shouldReclip(TabClipper oldClipper) => true; double degreeToRadians(double degree) { final double redian = (math.pi / 180) * degree; return redian; } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/running_view.dart
import 'package:flutter/material.dart'; import '../fintness_app_theme.dart'; class RunningView extends StatelessWidget { final AnimationController animationController; final Animation animation; const RunningView({Key key, this.animationController, this.animation}) : super(key: key); @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: new Transform( transform: new Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 0, bottom: 0), child: Stack( overflow: Overflow.visible, children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 16, bottom: 16), child: Container( decoration: BoxDecoration( color: FitnessAppTheme.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(8.0)), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey.withOpacity(0.4), offset: Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Stack( alignment: Alignment.topLeft, children: <Widget>[ ClipRRect( borderRadius: BorderRadius.all(Radius.circular(8.0)), child: SizedBox( height: 74, child: AspectRatio( aspectRatio: 1.714, child: Image.asset( "assets/fitness_app/back.png"), ), ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 100, right: 16, top: 16, ), child: Text( "You're doing great!", textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.nearlyDarkBlue, ), ), ), ], ), Padding( padding: const EdgeInsets.only( left: 100, bottom: 12, top: 4, right: 16, ), child: Text( "Keep it up\nand stick to your plan!", textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 10, letterSpacing: 0.0, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), ], ), ), ), Positioned( top: -16, left: 0, child: SizedBox( width: 110, height: 110, child: Image.asset("assets/fitness_app/runner.png"), ), ) ], ), ), ], ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/area_list_view.dart
import 'package:flutter/material.dart'; import '../fintness_app_theme.dart'; class AreaListView extends StatefulWidget { const AreaListView( {Key key, this.mainScreenAnimationController, this.mainScreenAnimation}) : super(key: key); final AnimationController mainScreenAnimationController; final Animation<dynamic> mainScreenAnimation; @override _AreaListViewState createState() => _AreaListViewState(); } class _AreaListViewState extends State<AreaListView> with TickerProviderStateMixin { AnimationController animationController; List<String> areaListData = <String>[ 'assets/fitness_app/area1.png', 'assets/fitness_app/area2.png', 'assets/fitness_app/area3.png', 'assets/fitness_app/area1.png', ]; @override void initState() { animationController = AnimationController( duration: const Duration(milliseconds: 2000), vsync: this); super.initState(); } @override void dispose() { animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return AnimatedBuilder( animation: widget.mainScreenAnimationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: widget.mainScreenAnimation, child: Transform( transform: Matrix4.translationValues( 0.0, 30 * (1.0 - widget.mainScreenAnimation.value), 0.0), child: AspectRatio( aspectRatio: 1.0, child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8), child: GridView( padding: const EdgeInsets.only( left: 16, right: 16, top: 16, bottom: 16), physics: const BouncingScrollPhysics(), scrollDirection: Axis.vertical, children: List<Widget>.generate( areaListData.length, (int index) { final int count = areaListData.length; final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Interval((1 / count) * index, 1.0, curve: Curves.fastOutSlowIn), ), ); animationController.forward(); return AreaView( imagepath: areaListData[index], animation: animation, animationController: animationController, ); }, ), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, mainAxisSpacing: 24.0, crossAxisSpacing: 24.0, childAspectRatio: 1.0, ), ), ), ), ), ); }, ); } } class AreaView extends StatelessWidget { const AreaView({ Key key, this.imagepath, this.animationController, this.animation, }) : super(key: key); final String imagepath; final AnimationController animationController; final Animation<dynamic> animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: Transform( transform: Matrix4.translationValues( 0.0, 50 * (1.0 - animation.value), 0.0), child: Container( decoration: BoxDecoration( color: FitnessAppTheme.white, borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(8.0)), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey.withOpacity(0.4), offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Material( color: Colors.transparent, child: InkWell( focusColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, borderRadius: const BorderRadius.all(Radius.circular(8.0)), splashColor: FitnessAppTheme.nearlyDarkBlue.withOpacity(0.2), onTap: () {}, child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 16, left: 16, right: 16), child: Image.asset(imagepath), ), ], ), ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/mediterranesn_diet_view.dart
import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; import 'dart:math' as math; class MediterranesnDietView extends StatelessWidget { final AnimationController animationController; final Animation animation; const MediterranesnDietView( {Key key, this.animationController, this.animation}) : super(key: key); @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: new Transform( transform: new Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( color: FitnessAppTheme.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey.withOpacity(0.2), offset: Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 16, left: 16, right: 16), child: Row( children: <Widget>[ Expanded( child: Padding( padding: const EdgeInsets.only( left: 8, right: 8, top: 4), child: Column( children: <Widget>[ Row( children: <Widget>[ Container( height: 48, width: 2, decoration: BoxDecoration( color: HexColor('#87A0E5') .withOpacity(0.5), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), ), Padding( padding: const EdgeInsets.all(8.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 4, bottom: 2), child: Text( 'Eaten', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.1, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ SizedBox( width: 28, height: 28, child: Image.asset( "assets/fitness_app/eaten.png"), ), Padding( padding: const EdgeInsets.only( left: 4, bottom: 3), child: Text( '${(1127 * animation.value).toInt()}', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 16, color: FitnessAppTheme .darkerText, ), ), ), Padding( padding: const EdgeInsets.only( left: 4, bottom: 3), child: Text( 'Kcal', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.2, color: FitnessAppTheme .grey .withOpacity(0.5), ), ), ), ], ) ], ), ) ], ), SizedBox( height: 8, ), Row( children: <Widget>[ Container( height: 48, width: 2, decoration: BoxDecoration( color: HexColor('#F56E98') .withOpacity(0.5), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), ), Padding( padding: const EdgeInsets.all(8.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 4, bottom: 2), child: Text( 'Burned', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.1, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ SizedBox( width: 28, height: 28, child: Image.asset( "assets/fitness_app/burned.png"), ), Padding( padding: const EdgeInsets.only( left: 4, bottom: 3), child: Text( '${(102 * animation.value).toInt()}', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 16, color: FitnessAppTheme .darkerText, ), ), ), Padding( padding: const EdgeInsets.only( left: 8, bottom: 3), child: Text( 'Kcal', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.2, color: FitnessAppTheme .grey .withOpacity(0.5), ), ), ), ], ) ], ), ) ], ) ], ), ), ), Padding( padding: const EdgeInsets.only(right: 16), child: Center( child: Stack( overflow: Overflow.visible, children: <Widget>[ Padding( padding: const EdgeInsets.all(8.0), child: Container( width: 100, height: 100, decoration: BoxDecoration( color: FitnessAppTheme.white, borderRadius: BorderRadius.all( Radius.circular(100.0), ), border: new Border.all( width: 4, color: FitnessAppTheme .nearlyDarkBlue .withOpacity(0.2)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( '${(1503 * animation.value).toInt()}', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 24, letterSpacing: 0.0, color: FitnessAppTheme .nearlyDarkBlue, ), ), Text( 'Kcal left', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.bold, fontSize: 12, letterSpacing: 0.0, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ], ), ), ), Padding( padding: const EdgeInsets.all(4.0), child: CustomPaint( painter: CurvePainter( colors: [ FitnessAppTheme.nearlyDarkBlue, HexColor("#8A98E8"), HexColor("#8A98E8") ], angle: 140 + (360 - 140) * (1.0 - animation.value)), child: SizedBox( width: 108, height: 108, ), ), ) ], ), ), ) ], ), ), Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 8, bottom: 8), child: Container( height: 2, decoration: BoxDecoration( color: FitnessAppTheme.background, borderRadius: BorderRadius.all(Radius.circular(4.0)), ), ), ), Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 8, bottom: 16), child: Row( children: <Widget>[ Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Carbs', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, color: FitnessAppTheme.darkText, ), ), Padding( padding: const EdgeInsets.only(top: 4), child: Container( height: 4, width: 70, decoration: BoxDecoration( color: HexColor('#87A0E5').withOpacity(0.2), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), child: Row( children: <Widget>[ Container( width: ((70 / 1.2) * animation.value), height: 4, decoration: BoxDecoration( gradient: LinearGradient(colors: [ HexColor('#87A0E5'), HexColor('#87A0E5') .withOpacity(0.5), ]), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), ) ], ), ), ), Padding( padding: const EdgeInsets.only(top: 6), child: Text( '12g left', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, color: FitnessAppTheme.grey.withOpacity(0.5), ), ), ), ], ), ), Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Protein', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, color: FitnessAppTheme.darkText, ), ), Padding( padding: const EdgeInsets.only(top: 4), child: Container( height: 4, width: 70, decoration: BoxDecoration( color: HexColor('#F56E98') .withOpacity(0.2), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), child: Row( children: <Widget>[ Container( width: ((70 / 2) * animationController.value), height: 4, decoration: BoxDecoration( gradient: LinearGradient(colors: [ HexColor('#F56E98') .withOpacity(0.1), HexColor('#F56E98'), ]), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), ), ], ), ), ), Padding( padding: const EdgeInsets.only(top: 6), child: Text( '30g left', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), ], ), ), Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Fat', style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, color: FitnessAppTheme.darkText, ), ), Padding( padding: const EdgeInsets.only( right: 0, top: 4), child: Container( height: 4, width: 70, decoration: BoxDecoration( color: HexColor('#F1B440') .withOpacity(0.2), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), child: Row( children: <Widget>[ Container( width: ((70 / 2.5) * animationController.value), height: 4, decoration: BoxDecoration( gradient: LinearGradient(colors: [ HexColor('#F1B440') .withOpacity(0.1), HexColor('#F1B440'), ]), borderRadius: BorderRadius.all( Radius.circular(4.0)), ), ), ], ), ), ), Padding( padding: const EdgeInsets.only(top: 6), child: Text( '10g left', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), ], ), ) ], ), ) ], ), ), ), ), ); }, ); } } class CurvePainter extends CustomPainter { final double angle; final List<Color> colors; CurvePainter({this.colors, this.angle = 140}); @override void paint(Canvas canvas, Size size) { List<Color> colorsList = List<Color>(); if (colors != null) { colorsList = colors; } else { colorsList.addAll([Colors.white, Colors.white]); } final shdowPaint = new Paint() ..color = Colors.black.withOpacity(0.4) ..strokeCap = StrokeCap.round ..style = PaintingStyle.stroke ..strokeWidth = 14; final shdowPaintCenter = new Offset(size.width / 2, size.height / 2); final shdowPaintRadius = math.min(size.width / 2, size.height / 2) - (14 / 2); canvas.drawArc( new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, shdowPaint); shdowPaint.color = Colors.grey.withOpacity(0.3); shdowPaint.strokeWidth = 16; canvas.drawArc( new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, shdowPaint); shdowPaint.color = Colors.grey.withOpacity(0.2); shdowPaint.strokeWidth = 20; canvas.drawArc( new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, shdowPaint); shdowPaint.color = Colors.grey.withOpacity(0.1); shdowPaint.strokeWidth = 22; canvas.drawArc( new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, shdowPaint); final rect = new Rect.fromLTWH(0.0, 0.0, size.width, size.width); final gradient = new SweepGradient( startAngle: degreeToRadians(268), endAngle: degreeToRadians(270.0 + 360), tileMode: TileMode.repeated, colors: colorsList, ); final paint = new Paint() ..shader = gradient.createShader(rect) ..strokeCap = StrokeCap.round // StrokeCap.round is not recommended. ..style = PaintingStyle.stroke ..strokeWidth = 14; final center = new Offset(size.width / 2, size.height / 2); final radius = math.min(size.width / 2, size.height / 2) - (14 / 2); canvas.drawArc( new Rect.fromCircle(center: center, radius: radius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, paint); final gradient1 = new SweepGradient( tileMode: TileMode.repeated, colors: [Colors.white, Colors.white], ); var cPaint = new Paint(); cPaint..shader = gradient1.createShader(rect); cPaint..color = Colors.white; cPaint..strokeWidth = 14 / 2; canvas.save(); final centerToCircle = size.width / 2; canvas.save(); canvas.translate(centerToCircle, centerToCircle); canvas.rotate(degreeToRadians(angle + 2)); canvas.save(); canvas.translate(0.0, -centerToCircle + 14 / 2); canvas.drawCircle(new Offset(0, 0), 14 / 5, cPaint); canvas.restore(); canvas.restore(); canvas.restore(); } @override bool shouldRepaint(CustomPainter oldDelegate) { return true; } double degreeToRadians(double degree) { var redian = (math.pi / 180) * degree; return redian; } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/workout_view.dart
import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; import '../fintness_app_theme.dart'; class WorkoutView extends StatelessWidget { final AnimationController animationController; final Animation animation; const WorkoutView({Key key, this.animationController, this.animation}) : super(key: key); @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: new Transform( transform: new Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( gradient: LinearGradient(colors: [ FitnessAppTheme.nearlyDarkBlue, HexColor("#6F56E8") ], begin: Alignment.topLeft, end: Alignment.bottomRight), borderRadius: BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey.withOpacity(0.6), offset: Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Next workout', textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.white, ), ), Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( 'Legs Toning and\nGlutes Workout at Home', textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 20, letterSpacing: 0.0, color: FitnessAppTheme.white, ), ), ), SizedBox( height: 32, ), Padding( padding: const EdgeInsets.only(right: 4), child: Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 4), child: Icon( Icons.timer, color: FitnessAppTheme.white, size: 16, ), ), Padding( padding: const EdgeInsets.only(left: 4.0), child: Text( '68 min', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.white, ), ), ), Expanded( child: SizedBox(), ), Container( decoration: BoxDecoration( color: FitnessAppTheme.nearlyWhite, shape: BoxShape.circle, boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.nearlyBlack .withOpacity(0.4), offset: Offset(8.0, 8.0), blurRadius: 8.0), ], ), child: Padding( padding: const EdgeInsets.all(0.0), child: Icon( Icons.arrow_right, color: HexColor("#6F56E8"), size: 44, ), ), ) ], ), ) ], ), ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/body_measurement.dart
import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:flutter/material.dart'; class BodyMeasurementView extends StatelessWidget { final AnimationController animationController; final Animation animation; const BodyMeasurementView({Key key, this.animationController, this.animation}) : super(key: key); @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: new Transform( transform: new Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( color: FitnessAppTheme.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: <BoxShadow>[ BoxShadow( color: FitnessAppTheme.grey.withOpacity(0.2), offset: Offset(1.1, 1.1), blurRadius: 10.0), ], ), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 16, left: 16, right: 24), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 4, bottom: 8, top: 16), child: Text( 'Weight', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.1, color: FitnessAppTheme.darkText), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 4, bottom: 3), child: Text( '206.8', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 32, color: FitnessAppTheme.nearlyDarkBlue, ), ), ), Padding( padding: const EdgeInsets.only( left: 8, bottom: 8), child: Text( 'Ibs', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 18, letterSpacing: -0.2, color: FitnessAppTheme.nearlyDarkBlue, ), ), ), ], ), Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Icon( Icons.access_time, color: FitnessAppTheme.grey .withOpacity(0.5), size: 16, ), Padding( padding: const EdgeInsets.only(left: 4.0), child: Text( 'Today 8:26 AM', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), Padding( padding: const EdgeInsets.only( top: 4, bottom: 14), child: Text( 'InBody SmartScale', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 12, letterSpacing: 0.0, color: FitnessAppTheme.nearlyDarkBlue, ), ), ), ], ) ], ) ], ), ), Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 8, bottom: 8), child: Container( height: 2, decoration: BoxDecoration( color: FitnessAppTheme.background, borderRadius: BorderRadius.all(Radius.circular(4.0)), ), ), ), Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 8, bottom: 16), child: Row( children: <Widget>[ Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( '185 cm', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, color: FitnessAppTheme.darkText, ), ), Padding( padding: const EdgeInsets.only(top: 6), child: Text( 'Height', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, color: FitnessAppTheme.grey.withOpacity(0.5), ), ), ), ], ), ), Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( '27.3 BMI', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, color: FitnessAppTheme.darkText, ), ), Padding( padding: const EdgeInsets.only(top: 6), child: Text( 'Overweight', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), ], ), ), Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Text( '20%', style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, color: FitnessAppTheme.darkText, ), ), Padding( padding: const EdgeInsets.only(top: 6), child: Text( 'Body fat', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), ], ), ) ], ), ) ], ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/glass_view.dart
import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; import '../fintness_app_theme.dart'; class GlassView extends StatelessWidget { final AnimationController animationController; final Animation animation; const GlassView({Key key, this.animationController, this.animation}) : super(key: key); @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: new Transform( transform: new Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 0, bottom: 24), child: Stack( overflow: Overflow.visible, children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 16), child: Container( decoration: BoxDecoration( color: HexColor("#D7E0F9"), borderRadius: BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(8.0)), // boxShadow: <BoxShadow>[ // BoxShadow( // color: FitnessAppTheme.grey.withOpacity(0.2), // offset: Offset(1.1, 1.1), // blurRadius: 10.0), // ], ), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only( left: 68, bottom: 12, right: 16, top: 12), child: Text( 'Prepare your stomach for lunch with one or two glass of water', textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.nearlyDarkBlue .withOpacity(0.6), ), ), ), ], ), ), ), Positioned( top: -12, left: 0, child: SizedBox( width: 80, height: 80, child: Image.asset("assets/fitness_app/glass.png"), ), ) ], ), ), ], ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/title_view.dart
import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:flutter/material.dart'; class TitleView extends StatelessWidget { final String titleTxt; final String subTxt; final AnimationController animationController; final Animation animation; const TitleView( {Key key, this.titleTxt: "", this.subTxt: "", this.animationController, this.animation}) : super(key: key); @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, builder: (BuildContext context, Widget child) { return FadeTransition( opacity: animation, child: new Transform( transform: new Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Container( child: Padding( padding: const EdgeInsets.only(left: 24, right: 24), child: Row( children: <Widget>[ Expanded( child: Text( titleTxt, textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 18, letterSpacing: 0.5, color: FitnessAppTheme.lightText, ), ), ), InkWell( highlightColor: Colors.transparent, borderRadius: BorderRadius.all(Radius.circular(4.0)), onTap: () {}, child: Padding( padding: const EdgeInsets.only(left: 8), child: Row( children: <Widget>[ Text( subTxt, textAlign: TextAlign.left, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 16, letterSpacing: 0.5, color: FitnessAppTheme.nearlyDarkBlue, ), ), SizedBox( height: 38, width: 26, child: Icon( Icons.arrow_forward, color: FitnessAppTheme.darkText, size: 18, ), ), ], ), ), ) ], ), ), ), ), ); }, ); } }
0
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app
mirrored_repositories/best_flutter_ui_templates/lib/fitness_app/ui_view/wave_view.dart
import 'dart:math' as math; import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:flutter/material.dart'; import 'package:vector_math/vector_math.dart' as vector; class WaveView extends StatefulWidget { final double percentageValue; const WaveView({Key key, this.percentageValue = 100.0}) : super(key: key); @override _WaveViewState createState() => _WaveViewState(); } class _WaveViewState extends State<WaveView> with TickerProviderStateMixin { AnimationController animationController; AnimationController waveAnimationController; Offset bottleOffset1 = Offset(0, 0); List<Offset> animList1 = []; Offset bottleOffset2 = Offset(60, 0); List<Offset> animList2 = []; @override void initState() { animationController = AnimationController( duration: Duration(milliseconds: 2000), vsync: this); waveAnimationController = AnimationController( duration: Duration(milliseconds: 2000), vsync: this); animationController ..addStatusListener((status) { if (status == AnimationStatus.completed) { animationController.reverse(); } else if (status == AnimationStatus.dismissed) { animationController.forward(); } }); waveAnimationController.addListener(() { animList1.clear(); for (int i = -2 - bottleOffset1.dx.toInt(); i <= 60 + 2; i++) { animList1.add( new Offset( i.toDouble() + bottleOffset1.dx.toInt(), math.sin((waveAnimationController.value * 360 - i) % 360 * vector.degrees2Radians) * 4 + (((100 - widget.percentageValue) * 160 / 100)), ), ); } animList2.clear(); for (int i = -2 - bottleOffset2.dx.toInt(); i <= 60 + 2; i++) { animList2.add( new Offset( i.toDouble() + bottleOffset2.dx.toInt(), math.sin((waveAnimationController.value * 360 - i) % 360 * vector.degrees2Radians) * 4 + (((100 - widget.percentageValue) * 160 / 100)), ), ); } }); waveAnimationController.repeat(); animationController.forward(); super.initState(); } @override void dispose() { animationController.dispose(); waveAnimationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Container( alignment: Alignment.center, child: new AnimatedBuilder( animation: new CurvedAnimation( parent: animationController, curve: Curves.easeInOut, ), builder: (context, child) => new Stack( children: <Widget>[ new ClipPath( child: new Container( decoration: BoxDecoration( color: FitnessAppTheme.nearlyDarkBlue.withOpacity(0.5), borderRadius: BorderRadius.only( topLeft: Radius.circular(80.0), bottomLeft: Radius.circular(80.0), bottomRight: Radius.circular(80.0), topRight: Radius.circular(80.0)), gradient: LinearGradient( colors: [ FitnessAppTheme.nearlyDarkBlue.withOpacity(0.2), FitnessAppTheme.nearlyDarkBlue.withOpacity(0.5) ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), ), ), clipper: new WaveClipper(animationController.value, animList1), ), new ClipPath( child: new Container( decoration: BoxDecoration( color: FitnessAppTheme.nearlyDarkBlue, gradient: LinearGradient( colors: [ FitnessAppTheme.nearlyDarkBlue.withOpacity(0.4), FitnessAppTheme.nearlyDarkBlue ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: BorderRadius.only( topLeft: Radius.circular(80.0), bottomLeft: Radius.circular(80.0), bottomRight: Radius.circular(80.0), topRight: Radius.circular(80.0)), ), ), clipper: new WaveClipper(animationController.value, animList2), ), Padding( padding: const EdgeInsets.only(top: 48), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( widget.percentageValue.round().toString(), textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 24, letterSpacing: 0.0, color: FitnessAppTheme.white, ), ), Padding( padding: const EdgeInsets.only(top: 3.0), child: Text( '%', textAlign: TextAlign.center, style: TextStyle( fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: FitnessAppTheme.white, ), ), ), ], ), ), ), Positioned( top: 0, left: 6, bottom: 8, child: new ScaleTransition( alignment: Alignment.center, scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: animationController, curve: Interval(0.0, 1.0, curve: Curves.fastOutSlowIn))), child: Container( width: 2, height: 2, decoration: BoxDecoration( color: FitnessAppTheme.white.withOpacity(0.4), shape: BoxShape.circle, ), ), ), ), Positioned( left: 24, right: 0, bottom: 16, child: new ScaleTransition( alignment: Alignment.center, scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: animationController, curve: Interval(0.4, 1.0, curve: Curves.fastOutSlowIn))), child: Container( width: 4, height: 4, decoration: BoxDecoration( color: FitnessAppTheme.white.withOpacity(0.4), shape: BoxShape.circle, ), ), ), ), Positioned( left: 0, right: 24, bottom: 32, child: new ScaleTransition( alignment: Alignment.center, scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: animationController, curve: Interval(0.6, 0.8, curve: Curves.fastOutSlowIn))), child: Container( width: 3, height: 3, decoration: BoxDecoration( color: FitnessAppTheme.white.withOpacity(0.4), shape: BoxShape.circle, ), ), ), ), Positioned( top: 0, right: 20, bottom: 0, child: new Transform( transform: new Matrix4.translationValues( 0.0, 16 * (1.0 - animationController.value), 0.0), child: Container( width: 4, height: 4, decoration: BoxDecoration( color: FitnessAppTheme.white.withOpacity( animationController.status == AnimationStatus.reverse ? 0.0 : 0.4), shape: BoxShape.circle, ), ), ), ), Column( children: <Widget>[ AspectRatio( aspectRatio: 1, child: Image.asset("assets/fitness_app/bottle.png"), ), ], ) ], ), ), ); } } class WaveClipper extends CustomClipper<Path> { final double animation; List<Offset> waveList1 = []; WaveClipper(this.animation, this.waveList1); @override Path getClip(Size size) { Path path = new Path(); path.addPolygon(waveList1, false); path.lineTo(size.width, size.height); path.lineTo(0.0, size.height); path.close(); return path; } @override bool shouldReclip(WaveClipper oldClipper) => animation != oldClipper.animation; }
0
mirrored_repositories/best_flutter_ui_templates
mirrored_repositories/best_flutter_ui_templates/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:best_flutter_ui_templates/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-News-API
mirrored_repositories/Flutter-News-API/lib/NewsCard.dart
import 'package:flutter/material.dart'; class NewsCard extends StatelessWidget{ final String name,urlToImage,url,title, author, description; NewsCard({this.name,this.title,this.urlToImage,this.description,this.author,this.url}); @override Widget build(BuildContext context) { return new Card( elevation: 4.0, child: new Container( padding: new EdgeInsets.all(12.0), child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ new Container( margin: const EdgeInsets.only(right:16.0), child: new CircleAvatar(child: new Text(name[0]),) ), new Expanded(child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ new Container( child: new Text(title,style: TextStyle(fontSize: 18.0),), margin: EdgeInsets.only(bottom: 10.0), ), new Text(description) ], )) ], ) ), ); } }
0
mirrored_repositories/Flutter-News-API
mirrored_repositories/Flutter-News-API/lib/HomePage.dart
import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; import 'package:news_app/NewsCard.dart'; final String API_KEY = "43dc7e323fc94b659ce4c7b70f7137d2"; final String end_point = "https://newsapi.org/v2/"; String apiURL(){ String url = end_point+"top-headlines?sources=the-hindu&apiKey="+API_KEY; return url; } class HomePage extends StatefulWidget{ @override State<HomePage> createState() { return new _HomePageState(); } } class _HomePageState extends State<HomePage> { final List<NewsCard> _news = <NewsCard>[]; var resBody; bool loading = true; Brightness bright = Brightness.light; _toggle(bright){ setState(() { this.bright = bright; }); } getUserInfo() async { var res = await http .get( Uri.encodeFull(apiURL()), headers: {"Accept": "application/json"} ); resBody = json.decode(res.body); if(resBody['status'] == 'ok'){ _news.clear(); print(resBody['articles']); for(var data in resBody['articles']){ print(data); _news.add(new NewsCard( title:data['title'], author: data['author'], description: data['description'], name: data['source']['name'], url: data['url'], urlToImage: data['urlToImage'], )); } setState(() { loading = false; print("Loaded Data"); }); }else{ print("Something Went Wrong"+resBody); } } Widget _buildBody() { if(loading){ return new Center( child: new CircularProgressIndicator(), ); }else{ return new Column( children: <Widget>[ new Flexible( child: new ListView.builder( padding: new EdgeInsets.all(8.0), reverse: true, itemBuilder: (_, int index) => _news[index], itemCount: _news.length, ) ), ], ); } } @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text("News API App"), ), body: new Center( child:_buildBody(), ), drawer: new Drawer( child: new ListView( physics: const AlwaysScrollableScrollPhysics(), children: <Widget>[ const DrawerHeader( child: const Center(child: const Text('News API',style: TextStyle(fontSize: 22.0),))), const ListTile( title: const Text('Home'), selected: true, ), const ListTile( title: const Text('Available Newspaper'), ), const Divider(), new ListTile( title: const Text('Light'), trailing: new Radio( value: "Light", groupValue: "Brighness", onChanged: null, ), onTap: () { print("light"); _toggle(Brightness.light); print(bright); }, ), new ListTile( title: const Text('Dark'), trailing: new Radio( value: "Dark", groupValue: "Brighness", onChanged: null, ), onTap: () { print("dark"); _toggle(Brightness.dark); print(bright); }, ), const Divider(), new ListTile( title: new Text("Settings"), ), new ListTile( title: new Text("Share"), ), ], ), ), ); } @override void initState() { getUserInfo(); super.initState(); } }
0
mirrored_repositories/Flutter-News-API
mirrored_repositories/Flutter-News-API/lib/main.dart
import 'package:flutter/material.dart'; import 'package:news_app/HomePage.dart'; void main(){ runApp(new MyApp()); } class MyApp extends StatelessWidget{ @override Widget build(BuildContext context) { return new MaterialApp( title: "News API", home: new HomePage(), theme: new ThemeData( primarySwatch: Colors.red ), ); } }
0
mirrored_repositories/Flutter-News-API/lib
mirrored_repositories/Flutter-News-API/lib/generated/i18n.dart
import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; class S extends WidgetsLocalizations { Locale _locale; String _lang; S(this._locale) { _lang = getLang(_locale); print('Current locale: $_lang'); } static final GeneratedLocalizationsDelegate delegate = new GeneratedLocalizationsDelegate(); static S of(BuildContext context) { var s = Localizations.of<S>(context, WidgetsLocalizations); s._lang = getLang(s._locale); return s; } @override TextDirection get textDirection => TextDirection.ltr; } class en extends S { en(Locale locale) : super(locale); } class GeneratedLocalizationsDelegate extends LocalizationsDelegate<WidgetsLocalizations> { const GeneratedLocalizationsDelegate(); List<Locale> get supportedLocales { return [ new Locale("en", ""), ]; } LocaleResolutionCallback resolution({Locale fallback}) { return (Locale locale, Iterable<Locale> supported) { var languageLocale = new Locale(locale.languageCode, ""); if (supported.contains(locale)) return locale; else if (supported.contains(languageLocale)) return languageLocale; else { var fallbackLocale = fallback ?? supported.first; return fallbackLocale; } }; } Future<WidgetsLocalizations> load(Locale locale) { String lang = getLang(locale); switch (lang) { case "en": return new SynchronousFuture<WidgetsLocalizations>(new en(locale)); default: return new SynchronousFuture<WidgetsLocalizations>(new S(locale)); } } bool isSupported(Locale locale) => supportedLocales.contains(locale); bool shouldReload(GeneratedLocalizationsDelegate old) => false; } String getLang(Locale l) => l.countryCode != null && l.countryCode.isEmpty ? l.languageCode : l.toString();
0
mirrored_repositories/learning-dart
mirrored_repositories/learning-dart/test/dart_course_test.dart
import 'package:dart_course/dart_course.dart'; import 'package:test/test.dart'; void main() { print("Hello world"); }
0
mirrored_repositories/learning-dart
mirrored_repositories/learning-dart/bin/main.dart
void main() { findPerimeter(2 ,4); int area = getArea(5, 8); print(area); } void findPerimeter( int length, int breadth) => print("The perimeter is: ${2 * (length + breadth) }"); //return area int getArea(int length, int breadth) => length * breadth; //https://www.youtube.com/watch?v=pH-CP8s_xK8&list=PLlxmoA0rQ-LyHW9voBdNo4gEEIh0SjG-q&index=21
0
mirrored_repositories/whatsapp_clone_flutter
mirrored_repositories/whatsapp_clone_flutter/lib/whatsapp_home.dart
import 'package:flutter/material.dart'; import 'package:whatsapp_clone_flutter/page/call_screen.dart'; import 'package:whatsapp_clone_flutter/page/camera_screen.dart'; import 'package:whatsapp_clone_flutter/page/chat_screen.dart'; import 'package:whatsapp_clone_flutter/page/status_screen.dart'; import 'package:camera/camera.dart'; class WhatsAppHome extends StatefulWidget { final List<CameraDescription> cameras; WhatsAppHome({this.cameras}); _WhatsAppHomeState createState() => _WhatsAppHomeState(); } class _WhatsAppHomeState extends State<WhatsAppHome> with SingleTickerProviderStateMixin { TabController _tabController; bool showFab = true; @override void initState() { super.initState(); _tabController = TabController(vsync: this, initialIndex: 1, length: 4); _tabController.addListener(() { if (_tabController.index == 1) { showFab = true; } else { showFab = false; } setState(() {}); }); } final GlobalKey _menuKey = new GlobalKey(); @override Widget build(BuildContext context) { var customFabButton; if (_tabController.index == 1) { customFabButton = CustomFabButton( color: Color(0Xff128C7E), onPressed: () => null, icon: Icons.message, ); } else if (_tabController.index == 2) { customFabButton = Container( child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ Container( height: 40, child: CustomFabButton( color: Colors.grey[800], onPressed: () => null, icon: Icons.edit, size: 20, ), ), Container( height: 15, ), CustomFabButton( color: Color(0Xff128C7E), onPressed: () => null, icon: Icons.camera, ) ], )); } else if (_tabController.index == 3) { customFabButton = CustomFabButton( color: Color(0Xff128C7E), onPressed: () => null, icon: Icons.add_call, ); } var popup_Menu_Button; if (_tabController.index == 1) { popup_Menu_Button = Theme( data: Theme.of(context).copyWith(cardColor: Colors.blueGrey[800]), child: PopupMenuButton<int>( itemBuilder: (context) => [ PopupMenuItem( value: 1, child: Text( "New group", style: TextStyle( color: Colors.white, ), ), ), PopupMenuItem( value: 2, child: Text( "New broadcast", style: TextStyle( color: Colors.white, ), ), ), PopupMenuItem( value: 3, child: Text( "WhatsAppWeb", style: TextStyle( color: Colors.white, ), ), ), PopupMenuItem( value: 4, child: Text( "Starred messages", style: TextStyle( color: Colors.white, ), ), ), PopupMenuItem( value: 5, child: Text( "Settings", style: TextStyle( color: Colors.white, ), ), ), ], icon: Icon( Icons.more_vert, color: Colors.grey, ), offset: Offset(0, 100), )); } else if (_tabController.index == 2) { popup_Menu_Button = Theme( data: Theme.of(context).copyWith(cardColor: Colors.blueGrey[800]), child: PopupMenuButton<int>( itemBuilder: (context) => [ PopupMenuItem( value: 1, child: Text( "Status privacy", style: TextStyle( color: Colors.white, ), ), ), PopupMenuItem( value: 2, child: Text( "Settings", style: TextStyle( color: Colors.white, ), ), ), ], icon: Icon( Icons.more_vert, color: Colors.grey, ), offset: Offset(0, 100), )); } else if (_tabController.index == 3) { popup_Menu_Button = Theme( data: Theme.of(context).copyWith(cardColor: Colors.blueGrey[800]), child: PopupMenuButton<int>( itemBuilder: (context) => [ PopupMenuItem( value: 1, child: Text( "Clear call log", style: TextStyle( color: Colors.white, ), ), ), PopupMenuItem( value: 2, child: Text( "Settings", style: TextStyle( color: Colors.white, ), ), ), ], icon: Icon( Icons.more_vert, color: Colors.grey, ), offset: Offset(0, 100), )); } else { popup_Menu_Button = Container(); } return Scaffold( backgroundColor: Colors.black, floatingActionButton: customFabButton, appBar: AppBar( backgroundColor: Color(0xff152d36), title: Text( "WhatsApp", style: TextStyle(color: Colors.grey), ), elevation: 0.7, bottom: TabBar( controller: _tabController, indicatorColor: Color(0Xff128C7E), labelColor: Color(0Xff128C7E), unselectedLabelColor: Colors.grey, tabs: <Widget>[ Tab( icon: Icon(Icons.camera_alt), ), Tab(text: "CHATS"), Tab( text: "STATUS", ), Tab( text: "CALLS", ), ], ), actions: <Widget>[ Icon( Icons.search, color: Colors.grey, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 5.0), ), popup_Menu_Button, Padding( padding: const EdgeInsets.symmetric(horizontal: 5.0), ) ], ), body: TabBarView( controller: _tabController, children: <Widget>[ CameraScreen(widget.cameras), ChatScreen(), StatusScreen(), CallsScreen(), ], ), ); } } class CustomFabButton extends StatelessWidget { final IconData icon; final Color color; final VoidCallback onPressed; final double size; const CustomFabButton( {Key key, this.icon, this.color, this.onPressed, this.size}) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: onPressed, child: AnimatedContainer( decoration: BoxDecoration( shape: BoxShape.circle, color: color, ), duration: Duration(seconds: 1), height: 50.0, width: 50.0, child: Icon( icon, color: Colors.white, size: size, ), ), ); } }
0
mirrored_repositories/whatsapp_clone_flutter
mirrored_repositories/whatsapp_clone_flutter/lib/main.dart
import 'package:flutter/material.dart'; import 'dart:async'; import 'package:camera/camera.dart'; import 'package:whatsapp_clone_flutter/whatsapp_home.dart'; List<CameraDescription> cameras; Future<Null> main() async { WidgetsFlutterBinding.ensureInitialized(); cameras = await availableCameras(); runApp(new MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return new MaterialApp( title: 'WhatsApp', theme: new ThemeData( primaryColor: new Color(0xff075E54), accentColor: new Color(0xff25D366), ), debugShowCheckedModeBanner: false, home: new WhatsAppHome(cameras:cameras), ); } }
0
mirrored_repositories/whatsapp_clone_flutter/lib
mirrored_repositories/whatsapp_clone_flutter/lib/page/status_screen.dart
import 'package:flutter/material.dart'; import 'package:whatsapp_clone_flutter/page/store_page_view.dart'; class StatusScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xff111D27), body: Container( // color: Color(0xfff2f2f2), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Card( elevation: 0.0, color: Color(0xff111D27), child: Padding( padding: const EdgeInsets.all(0.0), child: ListTile( leading: Stack( children: <Widget>[ new Container( width: 55.0, height: 70.0, decoration: new BoxDecoration( shape: BoxShape.circle, image: new DecorationImage( fit: BoxFit.fill, image: new NetworkImage( "https://avatars3.githubusercontent.com/u/55597383?s=400&u=5549a16ae62d223b0375d16f9bf52fda3329f6a0&v=4")))), Positioned( bottom: 0.0, right: 1.0, child: Container( height: 20, width: 20, child: Icon( Icons.add, color: Colors.white, size: 15, ), decoration: BoxDecoration( color: Colors.green, shape: BoxShape.circle), ), ) ], ), title: Text( "My status", style: TextStyle( fontWeight: FontWeight.w600, color: Colors.white), ), subtitle: Text( "Tap to add status update", style: TextStyle( fontWeight: FontWeight.w400, color: Colors.grey[400]), ), ), ), ), Padding( padding: const EdgeInsets.only(left: 20,top: 5,bottom: 5), child: Text("Recent updates", style: TextStyle( color: Colors.grey[400], fontWeight: FontWeight.bold)), ), Expanded( child: Container( padding: const EdgeInsets.all(0.0), color: Color(0xff111D27), child: ListView( children: <Widget>[ ListTile( leading: new Container( width: 55.0, height: 60.0, decoration: new BoxDecoration( shape: BoxShape.circle, image: new DecorationImage( fit: BoxFit.fill, image: new NetworkImage( "https://avatars3.githubusercontent.com/u/583231?v=4")))), title: Text( "Abubakar Pagas", style: TextStyle( fontWeight: FontWeight.w600, color: Colors.white), ), subtitle: Text( "Today, 20:16 PM", style: TextStyle( fontWeight: FontWeight.w600, color: Colors.grey[400]), ), onTap: () => Navigator.push( context, MaterialPageRoute( builder: (context) => StoryPageView())), ), Padding( padding: EdgeInsets.only(left: 70, right: 20), child: Divider( color: Colors.grey[800], ), ), ListTile( leading: new Container( width: 55.0, height: 70.0, decoration: new BoxDecoration( shape: BoxShape.circle, image: new DecorationImage( fit: BoxFit.fill, image: new NetworkImage( "https://avatars3.githubusercontent.com/u/583240?v=4")))), title: Text( "Jyotsna", style: TextStyle( fontWeight: FontWeight.w600, color: Colors.white), ), subtitle: Text( "Yesterday, 17:05 PM", style: TextStyle( fontWeight: FontWeight.w600, color: Colors.grey[400]), ), onTap: () => Navigator.push( context, MaterialPageRoute( builder: (context) => StoryPageView())), ), Padding( padding: EdgeInsets.only(left: 70, right: 20), child: Divider( color: Colors.grey[800], ), ), ], ), ), ) ], ), )); } }
0
mirrored_repositories/whatsapp_clone_flutter/lib
mirrored_repositories/whatsapp_clone_flutter/lib/page/chat_screen.dart
import 'package:flutter/material.dart'; import 'package:whatsapp_clone_flutter/model/chat_model.dart'; class ChatScreen extends StatefulWidget { _ChatScreenState createState() => _ChatScreenState(); } class _ChatScreenState extends State<ChatScreen> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xff111D27), body: new ListView.builder( itemCount: dummyData.length, itemBuilder: (context, i) => new Column( children: <Widget>[ Padding( padding: EdgeInsets.only(left: 70, right: 20), child: Divider( color: Colors.grey[800], ), ), new ListTile( leading: new Container( width: 50.0, height: 50.0, decoration: new BoxDecoration( shape: BoxShape.circle, image: new DecorationImage( fit: BoxFit.fill, image: new NetworkImage( dummyData[i].avatarUrl)))), title: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ new Text( dummyData[i].name, style: new TextStyle( fontWeight: FontWeight.bold, color: Colors.grey[300]), ), new Text(dummyData[i].time, style: new TextStyle( color: Colors.grey, fontSize: 11.0)) ], ), subtitle: new Container( padding: const EdgeInsets.only(top: 5.0), child: Row( children: <Widget>[ dummyData[i].icon == "single" ? Icon( Icons.check, size: 20, color: Colors.grey, ) : Icon( Icons.done_all, size: 20, color: Colors.grey, ), Container( width: 2, ), new Text(dummyData[i].message, style: new TextStyle( color: Colors.grey, fontSize: 15.0)) ], ))) ], ))); } }
0
mirrored_repositories/whatsapp_clone_flutter/lib
mirrored_repositories/whatsapp_clone_flutter/lib/page/call_screen.dart
import 'package:flutter/material.dart'; class CallsScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xff111D27), body: Container( child: ListView( children: <Widget>[ Container( height: 10, ), ListTile( leading: new Container( width: 50.0, height: 50.0, decoration: new BoxDecoration( shape: BoxShape.circle, image: new DecorationImage( fit: BoxFit.fill, image: new NetworkImage( "https://avatars3.githubusercontent.com/u/583231?v=4")))), title: Text( "Komal", style: TextStyle(color: Colors.white,fontWeight: FontWeight.w600), ), subtitle: Row( children: <Widget>[ Icon( Icons.call_made, color: Color(0Xff128C7E), size: 15, ), Container( width: 5, ), Text( "Today, 2:16 pm", style: TextStyle(color: Colors.grey), ), ], ), trailing: Icon( Icons.call, color: Color(0Xff128C7E), ), ), Padding( padding: EdgeInsets.only(left: 70, right: 20), child: Divider( color: Colors.grey[800], ), ), ListTile( leading: new Container( width: 50.0, height: 50.0, decoration: new BoxDecoration( shape: BoxShape.circle, image: new DecorationImage( fit: BoxFit.fill, image: new NetworkImage( "https://avatars3.githubusercontent.com/u/583233?v=4")))), title: Text( "Sandip", style: TextStyle(color: Colors.white,fontWeight: FontWeight.w600), ), subtitle: Row( children: <Widget>[ Icon( Icons.call_made, color: Color(0Xff128C7E), size: 15, ), Container( width: 5, ), Text( "Yesterday, 7:00 pm", style: TextStyle(color: Colors.grey), ), ], ), trailing: Icon( Icons.video_call, color: Color(0Xff128C7E), size: 30, ), ), Padding( padding: EdgeInsets.only(left: 70, right: 20), child: Divider( color: Colors.grey[800], ), ), ListTile( leading: new Container( width: 50.0, height: 50.0, decoration: new BoxDecoration( shape: BoxShape.circle, image: new DecorationImage( fit: BoxFit.fill, image: new NetworkImage( "https://avatars3.githubusercontent.com/u/583233?v=4")))), title: Text( "Sandip", style: TextStyle( color: Colors.white, fontWeight: FontWeight.w600), ), subtitle: Row( children: <Widget>[ Icon( Icons.call_received, color: Color(0Xff128C7E), size: 15, ), Container( width: 5, ), Text( "Yesterday, 6:30 pm", style: TextStyle(color: Colors.grey), ), ], ), trailing: Icon( Icons.call, color: Color(0Xff128C7E), size: 30, ), ), Padding( padding: EdgeInsets.only(left: 70, right: 20), child: Divider( color: Colors.grey[800], ), ), ], ), )); } }
0
mirrored_repositories/whatsapp_clone_flutter/lib
mirrored_repositories/whatsapp_clone_flutter/lib/page/camera_screen.dart
import 'package:flutter/material.dart'; import 'package:camera/camera.dart'; class CameraScreen extends StatefulWidget { final List<CameraDescription> cameras; CameraScreen(this.cameras); @override CameraScreenState createState() { return new CameraScreenState(); } } class CameraScreenState extends State<CameraScreen> { CameraController controller; @override void initState() { super.initState(); controller = new CameraController(widget.cameras[0], ResolutionPreset.medium); controller.initialize().then((_) { if (!mounted) { return; } setState(() {}); }); } @override void dispose() { controller?.dispose(); super.dispose(); } @override Widget build(BuildContext context) { if (!controller.value.isInitialized) { return new Container(); } return new AspectRatio( aspectRatio: controller.value.aspectRatio, child: new CameraPreview(controller), ); } }
0
mirrored_repositories/whatsapp_clone_flutter/lib
mirrored_repositories/whatsapp_clone_flutter/lib/page/store_page_view.dart
import 'package:flutter/material.dart'; import 'package:story_view/story_view.dart'; class StoryPageView extends StatelessWidget { @override Widget build(BuildContext context) { final List<StoryItem> storyItems = [ StoryItem.text('''Stay Home''', Colors.green), StoryItem.text("Stay Safe", Colors.yellow), StoryItem.text("We will fight with Covid-19", Colors.orange), ]; return Material( child: StoryView( storyItems, repeat: true, inline: false, ), ); } }
0
mirrored_repositories/whatsapp_clone_flutter/lib
mirrored_repositories/whatsapp_clone_flutter/lib/model/chat_model.dart
class ChatModel { final String name; final String message; final String time; final String avatarUrl; final String icon; ChatModel({this.name, this.message, this.time, this.avatarUrl, this.icon}); } List<ChatModel> dummyData = [ new ChatModel( name: "Anish Kumar", message: "Hey please share your code", time: "15:30 pm", avatarUrl: "https://avatars3.githubusercontent.com/u/583231?v=4", icon: "single"), new ChatModel( name: "Shubham Narkhede", message: "waiting for any work", time: "17:30 pm", avatarUrl: "https://avatars3.githubusercontent.com/u/55597383?s=400&u=5549a16ae62d223b0375d16f9bf52fda3329f6a0&v=4", icon: "double"), new ChatModel( name: "Jyotsna", message: "what are you doing?", time: "5:00 am", avatarUrl: "https://avatars3.githubusercontent.com/u/583233?v=4", icon: "single"), new ChatModel( name: "Yogita", message: "I'm good!", time: "10:30 am", avatarUrl: "https://avatars3.githubusercontent.com/u/583240?v=4", icon: "single"), new ChatModel( name: "Samman David", message: "I'm the fastest man alive!", time: "12:30 pm ", avatarUrl: "https://avatars3.githubusercontent.com/u/583235?v=4", icon: "double"), new ChatModel( name: "Joe West", message: "Hey Flutter, You are so cool !", time: "15:30 pm", avatarUrl: "http://www.usanetwork.com/sites/usanetwork/files/styles/629x720/public/suits_cast_harvey.jpg?itok=fpTOeeBb", icon: "double"), ];
0
mirrored_repositories/whatsapp_clone_flutter
mirrored_repositories/whatsapp_clone_flutter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:whatsapp_clone_flutter/main.dart'; void main() { // testWidgets('Counter increments smoke test', (WidgetTester tester) async { // // Build our app and trigger a frame. // await tester.pumpWidget(MyApp()); // // Verify that our counter starts at 0. // expect(find.text('0'), findsOneWidget); // expect(find.text('1'), findsNothing); // // Tap the '+' icon and trigger a frame. // await tester.tap(find.byIcon(Icons.add)); // await tester.pump(); // // Verify that our counter has incremented. // expect(find.text('0'), findsNothing); // expect(find.text('1'), findsOneWidget); // }); }
0
mirrored_repositories/FlutterApp-Aurora
mirrored_repositories/FlutterApp-Aurora/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'services/routers/router_provider.dart'; import 'services/themes/providers/theme_mode_provider.dart'; import 'services/themes/helpers/dark_mode/dark_mode_helper.dart'; import 'services/themes/helpers/light_mode/light_mode_helper.dart'; import 'services/localization/providers/localization_provider.dart'; import 'services/app_preference/providers/app_settings_provider.dart'; import '/src/pages/splash/splash_scree.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); runApp( const ProviderScope( child: Initializer(), ), ); } class Initializer extends ConsumerWidget { const Initializer({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final appSetting = ref.watch(appSettingsProvider); return appSetting.when( data: (value) => const AuroraApp(), loading: () => const SplashScreen(), error: (error, stack) => const Center( child: Text('Something went wrong. Please try again later.'), ), ); } } class AuroraApp extends ConsumerWidget { const AuroraApp({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final themeMode = ref.watch(appThemeServiceProvider); final routerConfig = ref.watch(routerProvider); final locale = ref.watch(appLocalizationServiceProvider); return MaterialApp.router( debugShowCheckedModeBanner: false, routerConfig: routerConfig, themeMode: themeMode, theme: ref.watch(lightThemeProvider), darkTheme: ref.watch(darkThemeProvider), localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, locale: locale, ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src
mirrored_repositories/FlutterApp-Aurora/lib/src/global/global.dart
export 'package/packages.dart'; export 'extention/extention.dart';
0
mirrored_repositories/FlutterApp-Aurora/lib/src/global
mirrored_repositories/FlutterApp-Aurora/lib/src/global/package/packages.dart
export 'package:flutter_riverpod/flutter_riverpod.dart';
0
mirrored_repositories/FlutterApp-Aurora/lib/src/global
mirrored_repositories/FlutterApp-Aurora/lib/src/global/extention/extention.dart
export '/services/localization/extention/locale_extention.dart';
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home/home_page.dart
import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart' show kDebugMode; import '/services/routers/app_router.dart'; import '/src/global/global.dart'; import 'providers/home_provider.dart'; import 'widgets/my_image_w.dart'; import 'sections/documentation_section.dart'; class HomePage extends ConsumerWidget { const HomePage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { ref.watch(homePageProvider(isDebug: kDebugMode)); return Scaffold( appBar: AppBar( title: Text(context.l10n.appTitle), actions: [ IconButton( onPressed: () => const SettingsRoute().push(context), icon: const Icon(Icons.settings), ) ], ), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 12.5), child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: const [ MyImageWidget(), SizedBox(height: 10), DocumentationSection() ], ), ), ), ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home/widgets/my_image_w.dart
import 'package:flutter/material.dart'; class MyImageWidget extends StatelessWidget { const MyImageWidget({super.key}); @override Widget build(BuildContext context) { return ClipOval( child: Image.network( 'https://pbs.twimg.com/profile_images/1623145746823544833/itUP4M2q_400x400.jpg', width: 100, height: 100, frameBuilder: (BuildContext context, Widget child, int? frame, bool wasSynchronouslyLoaded) { if (wasSynchronouslyLoaded) { return child; } return AnimatedOpacity( opacity: frame == null ? 0 : 1, duration: const Duration(seconds: 1), curve: Curves.easeOut, child: child, ); }, ), ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home/sections/documentation_section.dart
import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; import 'package:url_launcher/url_launcher.dart'; import '/services/localization/extention/locale_extention.dart'; class DocumentationSection extends StatelessWidget { const DocumentationSection({super.key}); @override Widget build(BuildContext context) { final contactUri = Uri.parse('https://monzim.com/contact'); final brickUri = Uri.parse('https://github.com/monzim/mason_bricks'); final sourceUri = Uri.parse('https://github.com/monzim/FlutterApp-Aurora'); Future<void> launchMe(Uri uri) async { try { await launchUrl(uri); } on Exception catch (e) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text(e.toString()), ), ); } } return Column( children: <Widget>[ RichText( textAlign: TextAlign.center, text: TextSpan( text: context.l10n.heyThere, style: TextStyle( color: Theme.of(context).buttonTheme.colorScheme?.primary, fontWeight: FontWeight.bold, fontSize: 16, ), children: [ TextSpan( text: '\n${context.l10n.iAmAzrafAlMonzim}', ) ]), ), const SizedBox(height: 10), RichText( textAlign: TextAlign.center, text: TextSpan( text: '${context.l10n.templateShortDescription} ', style: TextStyle( color: Theme.of(context).textTheme.bodyMedium?.color, fontSize: 15.5, ), children: [ TextSpan( text: 'packages', style: TextStyle( color: Theme.of(context).buttonTheme.colorScheme?.primary, fontWeight: FontWeight.w400, ), recognizer: TapGestureRecognizer() ..onTap = () { showDialog( context: context, builder: (context) { return AlertDialog( title: const Text('Packages'), content: const Text( '\n- intl\n- google_fonts\n- riverpod_annotation\n- flutter_localizations\n- build_runner\n- flutter_localizations\n- riverpod_lint\n- riverpod_generator\n- go_router_builder\n- build_verify'), actions: [ TextButton( onPressed: () => Navigator.pop(context), child: const Text('OK'), ) ], ); }); }, ), TextSpan(text: context.l10n.midDescription), TextSpan( text: '\nDocumentation', style: TextStyle( color: Theme.of(context).buttonTheme.colorScheme?.primary), recognizer: TapGestureRecognizer() ..onTap = () => launchMe(sourceUri), ), TextSpan( text: '\nSource Code', style: TextStyle( color: Theme.of(context).buttonTheme.colorScheme?.primary), recognizer: TapGestureRecognizer() ..onTap = () => launchMe(brickUri), ), TextSpan( text: '\n\n${context.l10n.contactMe}', style: TextStyle( color: Theme.of(context).buttonTheme.colorScheme?.primary), recognizer: TapGestureRecognizer() ..onTap = () => launchMe(contactUri), ), TextSpan( text: '.\n\n${context.l10n.startOnGithub} ', children: [ TextSpan( text: 'GitHub', style: TextStyle( color: Theme.of(context) .buttonTheme .colorScheme ?.primary), recognizer: TapGestureRecognizer() ..onTap = () => launchMe(sourceUri), ), const TextSpan( text: '.', ), TextSpan( text: '\n\n${context.l10n.thankYou}', style: TextStyle( color: Theme.of(context) .buttonTheme .colorScheme ?.primary, fontWeight: FontWeight.bold, ), ), ]), ])) ], ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home/providers/home_provider.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'home_provider.dart'; // ************************************************************************** // RiverpodGenerator // ************************************************************************** String _$homePageHash() => r'88b727ba6d965b62b97bf480e1be4118407cd270'; /// Copied from Dart SDK class _SystemHash { _SystemHash._(); static int combine(int hash, int value) { // ignore: parameter_assignments hash = 0x1fffffff & (hash + value); // ignore: parameter_assignments hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); return hash ^ (hash >> 6); } static int finish(int hash) { // ignore: parameter_assignments hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); // ignore: parameter_assignments hash = hash ^ (hash >> 11); return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); } } typedef HomePageRef = AutoDisposeProviderRef<void>; /// See also [homePage]. @ProviderFor(homePage) const homePageProvider = HomePageFamily(); /// See also [homePage]. class HomePageFamily extends Family<void> { /// See also [homePage]. const HomePageFamily(); /// See also [homePage]. HomePageProvider call({ bool isDebug = false, }) { return HomePageProvider( isDebug: isDebug, ); } @override HomePageProvider getProviderOverride( covariant HomePageProvider provider, ) { return call( isDebug: provider.isDebug, ); } static const Iterable<ProviderOrFamily>? _dependencies = null; @override Iterable<ProviderOrFamily>? get dependencies => _dependencies; static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null; @override Iterable<ProviderOrFamily>? get allTransitiveDependencies => _allTransitiveDependencies; @override String? get name => r'homePageProvider'; } /// See also [homePage]. class HomePageProvider extends AutoDisposeProvider<void> { /// See also [homePage]. HomePageProvider({ this.isDebug = false, }) : super.internal( (ref) => homePage( ref, isDebug: isDebug, ), from: homePageProvider, name: r'homePageProvider', debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') ? null : _$homePageHash, dependencies: HomePageFamily._dependencies, allTransitiveDependencies: HomePageFamily._allTransitiveDependencies, ); final bool isDebug; @override bool operator ==(Object other) { return other is HomePageProvider && other.isDebug == isDebug; } @override int get hashCode { var hash = _SystemHash.combine(0, runtimeType.hashCode); hash = _SystemHash.combine(hash, isDebug.hashCode); return _SystemHash.finish(hash); } } // ignore_for_file: unnecessary_raw_strings, subtype_of_sealed_class, invalid_use_of_internal_member, do_not_use_environment, prefer_const_constructors, public_member_api_docs, avoid_private_typedef_functions
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/home/providers/home_provider.dart
import 'package:riverpod_annotation/riverpod_annotation.dart'; import '/services/riverpod/riverpod.dart'; part 'home_provider.g.dart'; @riverpod void homePage( HomePageRef ref, { bool isDebug = false, }) { if (isDebug) { final hash = ref.formatHash; ProviderHelper.onInit('HomePageProvider', hash); ref.onResume(() => ProviderHelper.onWatch('HomePageProvider', hash)); ref.onDispose(() => ProviderHelper.onDispose('HomePageProvider', hash)); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/splash/splash_scree.dart
import 'package:flutter/material.dart'; class SplashScreen extends StatelessWidget { const SplashScreen({super.key}); @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.dark(), debugShowCheckedModeBanner: false, home: Scaffold( backgroundColor: Colors.black, body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: const <Widget>[ FlutterLogo(size: 100.0), Padding( padding: EdgeInsets.only(top: 20.0), child: Text('Flutter Aurora'), ) ], ), )), ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings/settings_page.dart
import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart' show kDebugMode; import '/src/global/global.dart'; import '/services/themes/providers/themes_provider.dart'; import '/services/app_preference/providers/app_settings_provider.dart'; import 'providers/settings_provider.dart'; import 'widgets/theme_toggle_widget.dart'; import 'sections/language_section.dart'; import 'sections/font_section.dart'; import 'sections/app_color_section.dart'; class SettingsPage extends ConsumerWidget { const SettingsPage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { ref.watch(settingsPageProvider(isDebug: kDebugMode)); final themeIcon = ref.watch(themeIconProvider); return Scaffold( appBar: AppBar( title: Text(context.l10n.settingsPageTitle), ), floatingActionButton: FloatingActionButton.extended( onPressed: () { ref.read(appSettingsProvider.notifier).reset(); }, icon: const Icon( Icons.refresh, ), label: Text(context.l10n.reset), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ // Appearance settings ListTile( title: Text(context.l10n.switchTheme), leading: Icon(themeIcon), trailing: const ThemeToggleWidget(), ), const LanguageSettingSection(), const FontSettingSection(), const AppColorSection() ], ), ), ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings/widgets/theme_toggle_widget.dart
import 'package:flutter/material.dart'; import '/src/global/global.dart'; import '/services/themes/providers/themes_provider.dart'; import '/services/app_preference/providers/app_settings_provider.dart'; class ThemeToggleWidget extends ConsumerWidget { const ThemeToggleWidget({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final isDarkMode = ref.watch(isDarkModeProvider); return Switch( value: isDarkMode, onChanged: (value) { ref.read(appSettingsProvider.notifier).toggleTheme(); // ref.read(appThemeServiceProvider.notifier).toggleTheme(); }, ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings/sections/font_section.dart
import 'package:flutter/material.dart'; import '/services/themes/constants/app_fonts.dart'; import '/services/themes/providers/font_family_provider.dart'; import '/services/app_preference/providers/app_settings_provider.dart'; import '/src/global/global.dart'; class FontSettingSection extends ConsumerWidget { const FontSettingSection({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final font = ref.watch(appFontServiceProvider); return ListTile( title: Text(context.l10n.changeFont), leading: const Icon(Icons.font_download), trailing: DropdownButton<String>( value: font, underline: const SizedBox.shrink(), alignment: Alignment.center, onChanged: (value) { ref.read(appSettingsProvider.notifier).updateFontFamily(value); }, items: AppFonts.list .map( (e) => DropdownMenuItem( value: e, child: Text( e?.replaceAll('_regular', '') ?? '', textAlign: TextAlign.center, ), ), ) .toList()), ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings/sections/language_section.dart
import 'package:flutter/material.dart'; import '/src/global/global.dart'; import '/services/localization/providers/localization_provider.dart'; import '/services/app_preference/providers/app_settings_provider.dart'; class LanguageSettingSection extends ConsumerWidget { const LanguageSettingSection({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final locale = ref.watch(appLocalizationServiceProvider); return ListTile( title: Text(context.l10n.switchLanguage), leading: const Icon(Icons.language), trailing: DropdownButton<Locale>( value: locale, underline: const SizedBox.shrink(), onChanged: (value) { // ref // .read(appLocalizationServiceProvider.notifier) // .setLocale(value ?? AppLocales.bnBD); ref.read(appSettingsProvider.notifier).updateLanguage( value?.languageCode == 'en' ? 'en' : 'bn', ); }, items: [ DropdownMenuItem( value: AppLocales.enUS, child: Text(context.l10n.english), ), DropdownMenuItem( value: AppLocales.bnBD, child: Text(context.l10n.bangla), ), ], ), ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings/sections/app_color_section.dart
import 'package:flutter/material.dart'; import '/src/global/global.dart'; import '/services/themes/providers/color_scheme_seed_provider.dart'; import '/services/app_preference/providers/app_settings_provider.dart'; extension ColorToHex on Color { String toHex() { return '#${value.toRadixString(16).padLeft(8, '0').substring(2)}'; } } class AppColorSection extends ConsumerWidget { const AppColorSection({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final List<Color> colors = [ Colors.red.toHex().hexToColor(), Colors.pink.toHex().hexToColor(), Colors.purple.toHex().hexToColor(), Colors.deepPurple.toHex().hexToColor(), Colors.indigo.toHex().hexToColor(), Colors.blue.toHex().hexToColor(), Colors.lightBlue.toHex().hexToColor(), Colors.cyan.toHex().hexToColor(), Colors.teal.toHex().hexToColor(), Colors.green.toHex().hexToColor(), Colors.lightGreen.toHex().hexToColor(), Colors.lime.toHex().hexToColor(), Colors.yellow.toHex().hexToColor(), Colors.amber.toHex().hexToColor(), Colors.orange.toHex().hexToColor(), Colors.deepOrange.toHex().hexToColor(), Colors.brown.toHex().hexToColor(), Colors.grey.toHex().hexToColor(), Colors.blueGrey.toHex().hexToColor(), ]; final colorSchemeSeed = ref.watch(appColorSchemeSeedProvider); return ListTile( title: Text(context.l10n.changeColor), leading: const Icon(Icons.color_lens), trailing: DropdownButton<Color>( value: colorSchemeSeed, onChanged: (color) { if (color != null) { ref.read(appSettingsProvider.notifier).updateColorSchemeSeed(color); } }, underline: const SizedBox.shrink(), items: colors .map( (color) => DropdownMenuItem<Color>( value: color, alignment: Alignment.center, child: Padding( padding: const EdgeInsets.symmetric(vertical: 1.5), child: Container( padding: const EdgeInsets.symmetric(horizontal: 10), decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(10), ), child: Center( child: Text( color.toHex().toUpperCase(), style: TextStyle( color: color.computeLuminance() > 0.5 ? Colors.black : Colors.white, ), ), ), ), ), ), ) .toList(), ), ); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings/providers/settings_provider.dart
import 'package:riverpod_annotation/riverpod_annotation.dart'; import '/services/riverpod/riverpod.dart'; part 'settings_provider.g.dart'; @riverpod void settingsPage( SettingsPageRef ref, { bool isDebug = false, }) { if (isDebug) { final hash = ref.formatHash; ProviderHelper.onInit('SettingPageProvider', hash); ref.onResume(() => ProviderHelper.onWatch('SettingPageProvider', hash)); ref.onDispose(() => ProviderHelper.onDispose('SettingPageProvider', hash)); } }
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/settings/providers/settings_provider.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'settings_provider.dart'; // ************************************************************************** // RiverpodGenerator // ************************************************************************** String _$settingsPageHash() => r'd634dd8476cbdd9ac561121079f7a5ae333854f0'; /// Copied from Dart SDK class _SystemHash { _SystemHash._(); static int combine(int hash, int value) { // ignore: parameter_assignments hash = 0x1fffffff & (hash + value); // ignore: parameter_assignments hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); return hash ^ (hash >> 6); } static int finish(int hash) { // ignore: parameter_assignments hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); // ignore: parameter_assignments hash = hash ^ (hash >> 11); return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); } } typedef SettingsPageRef = AutoDisposeProviderRef<void>; /// See also [settingsPage]. @ProviderFor(settingsPage) const settingsPageProvider = SettingsPageFamily(); /// See also [settingsPage]. class SettingsPageFamily extends Family<void> { /// See also [settingsPage]. const SettingsPageFamily(); /// See also [settingsPage]. SettingsPageProvider call({ bool isDebug = false, }) { return SettingsPageProvider( isDebug: isDebug, ); } @override SettingsPageProvider getProviderOverride( covariant SettingsPageProvider provider, ) { return call( isDebug: provider.isDebug, ); } static const Iterable<ProviderOrFamily>? _dependencies = null; @override Iterable<ProviderOrFamily>? get dependencies => _dependencies; static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null; @override Iterable<ProviderOrFamily>? get allTransitiveDependencies => _allTransitiveDependencies; @override String? get name => r'settingsPageProvider'; } /// See also [settingsPage]. class SettingsPageProvider extends AutoDisposeProvider<void> { /// See also [settingsPage]. SettingsPageProvider({ this.isDebug = false, }) : super.internal( (ref) => settingsPage( ref, isDebug: isDebug, ), from: settingsPageProvider, name: r'settingsPageProvider', debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') ? null : _$settingsPageHash, dependencies: SettingsPageFamily._dependencies, allTransitiveDependencies: SettingsPageFamily._allTransitiveDependencies, ); final bool isDebug; @override bool operator ==(Object other) { return other is SettingsPageProvider && other.isDebug == isDebug; } @override int get hashCode { var hash = _SystemHash.combine(0, runtimeType.hashCode); hash = _SystemHash.combine(hash, isDebug.hashCode); return _SystemHash.finish(hash); } } // ignore_for_file: unnecessary_raw_strings, subtype_of_sealed_class, invalid_use_of_internal_member, do_not_use_environment, prefer_const_constructors, public_member_api_docs, avoid_private_typedef_functions
0
mirrored_repositories/FlutterApp-Aurora/lib/src/pages
mirrored_repositories/FlutterApp-Aurora/lib/src/pages/error/error_page.dart
import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; class ErrorPage extends StatelessWidget { const ErrorPage({super.key, required this.error}); final Exception error; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('"Page Not Found"'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ ErrorWidget(error.toString()), TextButton( onPressed: () => context.go('/'), child: const Text('Return to Root Page'), ), ], ), ), ); } }
0