“Mobil ilovalarni ishlab chiqish” fanidan


title: const Text('Search a city')


Download 1.58 Mb.
bet6/9
Sana14.04.2023
Hajmi1.58 Mb.
#1358106
1   2   3   4   5   6   7   8   9
Bog'liq
1-lab mobil

,
title: const Text('Search a city'),
),
body: Padding(
padding: const EdgeInsets.all(16),
child: Form(
key: _formKey,
child: Column(
children: [
TextFormField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'Enter a city',
hintText: 'Enter a city',
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter a city';
} else if (value.length < 3) {
return 'Please enter at least 3 characters';
}
return null;
},
onSaved: (value) {
_city = value;
},
),
ElevatedButton(
onPressed: () => _submit(context),
child: const Text('GET WEATHER'),
),
],
),
),
),
);
}
}

import 'package:flutter/material.dart';


import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:weather_app/logic/cubits/settings/settings_cubit.dart';

class SettingsScreen extends StatelessWidget {
const SettingsScreen({Key? key}) : super(key: key);

static const routeName = '/settings';

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('Settings'),
),
body: ListTile(
title: const Text(
'Temperature unit',
),
subtitle: const Text('Celsius / Fahrenheit (default: Celsius'),
trailing: Switch.adaptive(
value:
context.watch().state.tempUnit == TempUnits.celsius
? true
: false,
onChanged: (value) {
context.read().toggleTemperature()

Download 1.58 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling