- Created CMakeLists.txt for Flutter and runner components. - Implemented resource script (Runner.rc) for application metadata. - Developed main entry point (main.cpp) for the Windows application. - Added FlutterWindow class to manage the Flutter view within a Win32 window. - Implemented utility functions for console management and command line argument parsing. - Established Win32Window class for high DPI-aware window handling. - Included application icon and manifest for proper Windows integration. - Set up build configurations and dependencies for the Flutter application on Windows.
40 lines
1.3 KiB
Dart
40 lines
1.3 KiB
Dart
import 'dart:convert';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:marco/helpers/services/json_decoder.dart';
|
|
import 'package:marco/model/identifier_model.dart';
|
|
|
|
class DragNDropModel extends IdentifierModel {
|
|
final String name, image, userName, contactNumber;
|
|
|
|
DragNDropModel(super.id, this.name, this.image, this.userName, this.contactNumber);
|
|
|
|
static DragNDropModel fromJSON(Map<String, dynamic> json) {
|
|
JSONDecoder decoder = JSONDecoder(json);
|
|
|
|
String name = decoder.getString('name');
|
|
String image = decoder.getString('image');
|
|
String userName = decoder.getString('user_name');
|
|
String contactNumber = decoder.getString('contact_number');
|
|
|
|
return DragNDropModel(decoder.getId, name, image, userName, contactNumber);
|
|
}
|
|
|
|
static List<DragNDropModel> listFromJSON(List<dynamic> list) {
|
|
return list.map((e) => DragNDropModel.fromJSON(e)).toList();
|
|
}
|
|
|
|
static List<DragNDropModel>? _dummyList;
|
|
|
|
static Future<List<DragNDropModel>> get dummyList async {
|
|
if (_dummyList == null) {
|
|
dynamic data = json.decode(await getData());
|
|
_dummyList = listFromJSON(data);
|
|
}
|
|
return _dummyList!;
|
|
}
|
|
|
|
static Future<String> getData() async {
|
|
return await rootBundle.loadString('assets/data/drag_n_drop_data.json');
|
|
}
|
|
}
|