This repository has been archived on 2025-08-25. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Seshat/lib/ui/add_page/view_model/add_view_model.dart

82 lines
1.7 KiB
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:seshat/domain/models/owner.dart';
class AddViewModel extends ChangeNotifier {
AddViewModel();
final _log = Logger("AddViewModel");
Owner? _currentOwner;
Owner? get currentOwner => _currentOwner;
set currentOwner(Owner? owner) {
_currentOwner = owner;
notifyListeners();
}
List<Owner>? _owners = [
Owner(
firstName: "Jean",
lastName: "Henri",
contact: "contact@gmail.com",
id: 1,
),
Owner(
firstName: "Jeanette",
lastName: "Henriette",
contact: "contact@gmail.com",
id: 2,
),
Owner(
firstName: "Jacques",
lastName: "Gerard",
contact: "contact@gmail.com",
id: 3,
),
Owner(
firstName: "Jacquelines",
lastName: "Geraldine",
contact: "contact@gmail.com",
id: 4,
),
Owner(
firstName: "Louis",
lastName: "Valentin",
contact: "contact@gmail.com",
id: 5,
),
Owner(
firstName: "Louise",
lastName: "Valentine",
contact: "contact@gmail.com",
id: 6,
),
];
List<Owner>? get owners => _owners;
Owner addOwner(String firstName, String lastName, String contact) {
_owners!.add(
Owner(
firstName: firstName,
lastName: lastName,
contact: contact,
id: _owners!.last.id + 1,
),
);
notifyListeners();
return Owner(
firstName: firstName,
lastName: lastName,
contact: contact,
id: 0,
);
}
bool _askPrice = true;
bool get askPrice => _askPrice;
set askPrice(bool newValue) {
_askPrice = newValue;
notifyListeners();
}
}