Guest User

explore_screen

a guest
Oct 10th, 2021
39
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2. import 'package:hi_flutter/components/today_recipe_list_view.dart';
  3.  
  4. import '../components/components.dart';
  5. import '../models/models.dart';
  6. import '../api/mock_fooderlich_service.dart';
  7.  
  8. class ExploreScreen extends StatelessWidget {
  9.   final mockService = MockFooderlichService();
  10.  
  11.   ExploreScreen({Key? key}) : super(key: key);
  12.  
  13.   @override
  14.   Widget build(BuildContext context) {
  15.     // 1
  16.     return FutureBuilder(
  17.       // 2
  18.       future: mockService.getExploreData(),
  19.       // 3
  20.       builder: (context, AsyncSnapshot<ExploreData> snapshot) {
  21.         // 4
  22.         if (snapshot.connectionState == ConnectionState.done) {
  23.           // 5
  24.           return ListView(
  25.             // 6
  26.             scrollDirection: Axis.vertical,
  27.             children: [
  28.               // 7
  29.               TodayRecipeListView(recipes: snapshot.data?.todayRecipes ?? []),
  30.               // 8
  31.               const SizedBox(height: 16),
  32.               // 9
  33.               // TODO: Replace this with FriendPostListView
  34.               Container(
  35.                 height: 400,
  36.                 color: Colors.green,
  37.               ),
  38.             ],
  39.           );
  40.         } else {
  41.           // 10
  42.           return const Center(child: CircularProgressIndicator());
  43.         }
  44.       },
  45.     );
  46.   }
  47.  
  48. }
  49.  
RAW Paste Data