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(),
},
),
),
)
Dostları ilə paylaş: |