feat:增加dio网络请求
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:food_hub_app/api/recipe.dart';
|
||||
import 'package:food_hub_app/api/session.dart';
|
||||
import 'package:food_hub_app/models/recipe.dart';
|
||||
import 'package:food_hub_app/models/session.dart';
|
||||
import 'package:food_hub_app/utils/sp_util.dart';
|
||||
import 'package:food_hub_app/widgets/common/index.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
||||
|
||||
class LoginPage extends StatefulWidget {
|
||||
@@ -25,7 +30,13 @@ class _LoginPage extends State<LoginPage> {
|
||||
];
|
||||
|
||||
void loginClick(BuildContext context) async {
|
||||
await loginApi("Cxx", "1232");
|
||||
SPUtil.clear();
|
||||
Session session = await loginApi("Cxx0822", "19940822Cxx");
|
||||
SPUtil.set('token', session.saToken.tokenValue);
|
||||
|
||||
Recipe recipe = await queryRecipeByIdApi(614660173221957);
|
||||
List<Recipe> recipeList = await queryRecipeByUserApi(691110779121733);
|
||||
// SPUtil.set("token", session?.saToken?.tokenValue);
|
||||
|
||||
// Navigator.pushNamed(context, '/home');
|
||||
return;
|
||||
|
||||
@@ -15,15 +15,9 @@ class RecordPage extends StatefulWidget {
|
||||
|
||||
class _RecordPageState extends State<RecordPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final List<Recipe> recipeList = [
|
||||
Recipe("韭菜炒鸡蛋", "家常菜", "2025-05-04", "https://picsum.photos/200", 10, 2, 4),
|
||||
Recipe("红烧肉", "家常菜", "2025-05-05", "https://picsum.photos/200", 12, 4, 7),
|
||||
];
|
||||
final List<Recipe> recipeList = [];
|
||||
|
||||
final List<Record> recordList = [
|
||||
Record("韭菜炒鸡蛋", "家常菜", "2025-05-04", "https://picsum.photos/200"),
|
||||
Record("红烧肉", "家常菜", "2025-05-05", "https://picsum.photos/200"),
|
||||
];
|
||||
final List<Record> recordList = [];
|
||||
|
||||
late final TabController _tabController = TabController(
|
||||
length: 3,
|
||||
@@ -68,7 +62,7 @@ class _RecordPageState extends State<RecordPage>
|
||||
children: [
|
||||
RecipeList(recipeList: recipeList),
|
||||
RecipeCalendar(),
|
||||
RecipeTimeline(recipeList: recipeList),
|
||||
RecipeTimeline(recordList: recordList),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user