;
final mainWeather = weather.main.toLowerCase();
String imagePath = '';
if (mainWeather.contains('rain')) {
imagePath = 'assets/rainy.jpg';
} else if (mainWeather.contains('sun')) {
imagePath = 'assets/sunny.jpg';
} else if (mainWeather.contains('cloud')) {
imagePath = 'assets/cloudy.jpeg';
} else {
imagePath = 'assets/night.jpg';
}
return Stack(
children: [
Image.asset(
imagePath,
fit: BoxFit.cover,
height: double.infinity,
width: double.infinity,
),
Container(
color: Colors.black.withOpacity(0.4),
),
WeatherMenu(getWeather: _getWeather),
SafeArea(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CityPart(
weather: weather,
),
Temperature(
weather: weather,
),
],
),
),
),
],
);
}
return Container();
},
),
);
}
}
import 'package:flutter/material.dart';
class SearchScreen extends StatelessWidget {
SearchScreen({Key? key}) : super(key: key);
static const routeName = '/search_city';
final _formKey = GlobalKey();
String? _city;
void _submit(BuildContext context) {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
Navigator.of(context).pop(_city);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true
Do'stlaringiz bilan baham: |