Untitled
unknown
dart
2 years ago
2.2 kB
12
Indexable
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:gorev/model/ProductionDetail.dart';
import 'package:gorev/model/ResultModel.dart';
class ProductionFeaturesPage extends StatefulWidget {
const ProductionFeaturesPage({super.key});
@override
State<ProductionFeaturesPage> createState() => _ProductionFeaturesPageState();
}
class _ProductionFeaturesPageState extends State<ProductionFeaturesPage> {
Future<List<ProductionDetail>> getProductionDetail() async {
final formData = FormData.fromMap({
'Action':'ProjectProductProductionModelGetByProjectID',
'Version':'1',
'Parameters': '{"ProjectID":"FEAD3706-84ED-ED11-9FCA-0050568D63AE"}'
});
BaseOptions options = BaseOptions(
baseUrl: "https://api.basefunder.com",
);
final respone = await Dio(options).post(
'Fintech/ExecuteWithoutAuth'
);
ResultModel resultModel = ResultModel.fromJson(respone.data);
List<ProductionDetail> _ProductionDetailList = [];
if (resultModel.IsSuccess == 1) {
var data = resultModel.Result;
for (var item in data) {
_ProductionDetailList.add(ProductionDetail.fromJson(item));
}
}
return _ProductionDetailList;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Production Features')),
body: Center(
child: FutureBuilder<List<ProductionDetail>>(
future: getProductionDetail(),
builder:(context, snapshot){
if (snapshot.hasData) {
return ListView.builder(
itemCount: snapshot.data!.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(snapshot.data![index].result.developmentProcesses),
subtitle: Text(snapshot.data![index].result.developmentProcesses),
);
},
);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}
return const CircularProgressIndicator();
} ),
),
);
}
}Editor is loading...