createState() => _HasInternetState();
}
bool isConnect = false;
class _HasInternetState extends State {
hasInternet() async {
try {
final result = await InternetAddress.lookup('example.com');
if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
setState(() {
isConnect = true;
});
}
} on SocketException catch (_) {
isConnect = false;
}
}
3-ram
home_screen.dart
import 'package:flutter/material.dart';
import 'package:football_score/screens/league_container.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
HomeScreenState createState() => HomeScreenState();
}
4-rasm
table_screen.dart
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:football_score/Screens/information_screen.dart';
import 'package:http/http.dart' as http;
class TableScreen extends StatefulWidget {
const TableScreen({Key? key, required this.code}) : super(key: key);
final String code;
@override
_TableScreenState createState() => _TableScreenState();
}
5-rasm
information_page.dart
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:http/http.dart' as http;
class InformationPage extends StatefulWidget {
const InformationPage({Key? key, required this.id, required this.code})
: super(key: key);
final String id, code;
@override
_InformationPageState createState() => _InformationPageState();
}
6-rasm