“Mobil ilovalarni ishlab chiqish” fanidan



Yüklə 1,58 Mb.
səhifə3/9
tarix17.06.2023
ölçüsü1,58 Mb.
#132099
1   2   3   4   5   6   7   8   9
“Mobil ilovalarni ishlab chiqish” fanidan

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(),
},
),
),
)

Yüklə 1,58 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin