|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/location_util.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/weather_slider/weather_slider.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class HealthWeatherIndicator extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_HospitalsPageState createState() => _HospitalsPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _HospitalsPageState extends State<HealthWeatherIndicator> {
|
|
|
|
|
var data;
|
|
|
|
|
LocationUtils locationUtils;
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
locationUtils =
|
|
|
|
|
new LocationUtils(isShowConfirmDialog: true, context: context);
|
|
|
|
|
WidgetsBinding.instance
|
|
|
|
|
.addPostFrameCallback((_) => locationUtils.getCurrentLocation());
|
|
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return BaseView<WeatherViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getWeatherData(),
|
|
|
|
|
builder: (_, mode, widget) => AppScaffold(
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).healthWeatherIndicators,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
baseViewModel: mode,
|
|
|
|
|
body: mode.weatherIndicatorData.length>0 ? SingleChildScrollView(
|
|
|
|
|
child: Column(children: [
|
|
|
|
|
Padding(padding: EdgeInsets.all(15), child:AppText( projectViewModel.isArabic ? mode.weatherIndicatorData[0].cityNameN : mode.weatherIndicatorData[0].cityName, fontSize: 24, fontWeight: FontWeight.bold,)),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
|
child: Column(children:
|
|
|
|
|
mode.weatherIndicatorData
|
|
|
|
|
.map((data) {
|
|
|
|
|
return WeatherSlider(
|
|
|
|
|
data);
|
|
|
|
|
}).toList()
|
|
|
|
|
|
|
|
|
|
))])) : Container(child:AppText('Loading...'))),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|