“Mobil ilovalarni ishlab chiqish” fanidan


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

Ishni bajarish:







import 'package:flutter/material.dart';


import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:http/http.dart';
import 'package:weather_app/logic/cubits/settings/settings_cubit.dart';
import 'package:weather_app/logic/cubits/weather/weather_cubit.dart';
import 'package:weather_app/presentation/screens/search_screen.dart';
import 'package:weather_app/presentation/screens/settings_screen.dart';

import 'logic/repositories/weather_repository.dart';
import 'logic/services/https/weather_api_services.dart';
import 'presentation/screens/home_screen.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {


const MyApp({super.key});

@override
Widget build(BuildContext context) {
return RepositoryProvider(
create: (context) => WeatherRepository(
weatherApiServices: WeatherApiServices(
client: Client(),
),
),
child: MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => WeatherCubit(
weatherRepository: context.read(),
),
),
BlocProvider(
create: (context) => SettingsCubit(),
),
],
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Weather App',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
home: const HomeScreen(),
routes: {
SearchScreen.routeName: (context) => SearchScreen(),
SettingsScreen.routeName: (context) => const SettingsScreen(),
},
),
),
)

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