Untitled

mail@pastecode.io avatar
unknown
dart
a year ago
2.2 kB
3
Indexable
Never
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();
          
          } ),
      ),
    );
  }
}