import 'package:ConversionFlutterDemo/convert_flutter.dart'; import 'package:ConversionFlutterDemo/models/convert_contain_options_bean.dart'; import 'package:ConversionFlutterDemo/models/convert_type.dart'; import 'package:flutter/material.dart'; import '../models/convert_bean.dart'; import 'package:path/path.dart'; class ConvertProvider extends ChangeNotifier { List _items = []; List get items => _items; void addConvertData(BuildContext context, String filePath, ConvertType convertType, ConvertOptionsBean options) { ConvertBean convertBean = ConvertBean( filePath: filePath, fileName: basename(filePath), convertType: convertType.name, status: convertConverting, progress: 0); _items.add(convertBean); ConvertFlutter.convert(context, _items.length - 1, convertBean, options); notifyListeners(); } void updateStatus( int position, int progress, int status, String? outputPath) { _items[position] ..status = status ..progress = progress ..outputPath = outputPath; notifyListeners(); } }