Skip to main content

Posts

Showing posts with the label part2

How To Create Live Cricket Match App In Flutter (Last Part)

  Step 6: Navigate to a match details screen Next, let's set up a way for the user to navigate to a screen with more details about a specific cricket match. Create a new file called match_details_screen.dart and add the following code to it: import 'package:flutter/material.dart'; import 'api.dart'; class MatchDetailsScreen extends StatefulWidget { final String matchId; MatchDetailsScreen({required this.matchId}); @override _MatchDetailsScreenState createState() => _MatchDetailsScreenState(); } class _MatchDetailsScreenState extends State<MatchDetailsScreen> { Map _matchDetails = {}; @override void initState() { super.initState(); _getMatchDetails(); } Future<void> _getMatchDetails() async { final data = await Api.get('cricketScore?unique_id=${widget.matchId}'); setState(() { _matchDetails = data; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: A...