This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
LocalSpend-Tracker/lib/common/widgets/organisations_dialog.dart

91 lines
2.5 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:local_spend/common/apifunctions/find_organisations.dart';
class FindOrganisations {
TextField getSearchBar(TextEditingController controller, String hintText) {
return TextField(
controller: controller,
decoration: InputDecoration(
hintText: hintText,
icon: Icon(Icons.search),
),
);
}
2019-08-07 13:02:36 +00:00
List<Text> getFavourites() {
var numItems = 200;
var itemsList = new List<Text>();
for (int i = 0; i < numItems; i++) {
itemsList.add(Text(
"Payee " + (i + 1).toString(),
style: new TextStyle(fontSize: 18),
));
}
return itemsList;
}
2019-08-07 13:02:36 +00:00
// todo: get all organisations, favourites and all data from one 'organisations' class or similar
// eg items: organisations.getFavourites().orderBy(name),
Future<Organisation> dialog(context) {
var searchBar = getSearchBar(null, "Payee Name");
2019-08-07 13:02:36 +00:00
var favourites = getFavourites();
return showDialog<Organisation>(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return SimpleDialog(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: searchBar,
),
2019-08-07 12:22:14 +00:00
Container(
padding: EdgeInsets.fromLTRB(20, 20, 0, 0),
child: Text(
"Favourites",
style: new TextStyle(fontSize: 23, fontWeight: FontWeight.bold),
),
),
Container(
2019-08-07 13:02:36 +00:00
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
width: MediaQuery.of(context).size.width * 0.7,
2019-08-07 13:02:36 +00:00
height: MediaQuery.of(context).size.height * 0.67,
child: Material(
shadowColor: Colors.transparent,
color: Colors.transparent,
child: ListView.builder(
2019-08-07 13:02:36 +00:00
itemCount: favourites.length,
itemBuilder: (context, index) {
return Card(
child: ListTile(
leading: Icon(Icons.person),
2019-08-07 13:02:36 +00:00
title: favourites[index],
trailing: Icon(Icons.arrow_forward_ios),
2019-08-07 13:02:36 +00:00
onTap: () {},
)
);
},
),
),
),
// help button for if org not listed
// cancel and ok buttons
],
);
},
);
}
}