-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from pvdthings/refactor-borrowers-module
Refactor borrowers module
- Loading branch information
Showing
30 changed files
with
127 additions
and
73 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
.../borrowers/data/borrowers_repository.dart → ...n/lib/core/data/borrowers_repository.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
apps/librarian/lib/modules/borrowers/details/borrower_details.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:librarian_app/modules/borrowers/details/contact_card.dart'; | ||
import 'package:librarian_app/modules/borrowers/providers/borrower_details_provider.dart'; | ||
import 'package:librarian_app/modules/borrowers/details/issues_card.dart'; | ||
import 'package:librarian_app/modules/borrowers/details/payments_card.dart'; | ||
|
||
class BorrowerDetails extends ConsumerWidget { | ||
const BorrowerDetails({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final borrowerDetails = ref.watch(borrowerDetailsProvider); | ||
|
||
return FutureBuilder( | ||
future: borrowerDetails, | ||
builder: (context, snapshot) { | ||
if (snapshot.connectionState == ConnectionState.waiting) { | ||
return const Center(child: CircularProgressIndicator()); | ||
} | ||
|
||
if (snapshot.hasError) { | ||
return Center(child: Text(snapshot.error.toString())); | ||
} | ||
|
||
final borrower = snapshot.data!; | ||
|
||
return Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
ContactCard( | ||
name: borrower.name, | ||
email: borrower.email, | ||
phone: borrower.phone, | ||
), | ||
const SizedBox(height: 32), | ||
IssuesCard( | ||
borrowerId: borrower.id, | ||
issues: borrower.issues, | ||
), | ||
const SizedBox(height: 32), | ||
const PaymentsCard(), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...rrower_details/borrower_details_pane.dart → ...rowers/details/borrower_details_pane.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...widgets/borrower_details/issues_card.dart → ...odules/borrowers/details/issues_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
apps/librarian/lib/modules/borrowers/details/needs_attention_page.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:librarian_app/core/api/models/borrower_model.dart'; | ||
|
||
import 'needs_attention_view.dart'; | ||
|
||
class NeedsAttentionPage extends StatelessWidget { | ||
const NeedsAttentionPage({super.key, required this.borrower}); | ||
|
||
final BorrowerModel borrower; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(title: Text(borrower.name)), | ||
body: NeedsAttentionView(borrower: borrower), | ||
); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...rrowers/widgets/needs_attention_view.dart → ...rrowers/details/needs_attention_view.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...idgets/borrowers_list/borrowers_list.dart → ...odules/borrowers/list/borrowers_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...owers_list/searchable_borrowers_list.dart → ...owers/list/searchable_borrowers_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/librarian/lib/modules/borrowers/providers/borrowers_provider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
apps/librarian/lib/modules/borrowers/providers/borrowers_repository_provider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/librarian/lib/modules/borrowers/providers/selected_borrower_provider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
import '../models/borrower_model.dart'; | ||
import '../../../core/api/models/borrower_model.dart'; | ||
|
||
final selectedBorrowerProvider = StateProvider<BorrowerModel?>((ref) => null); |
4 changes: 2 additions & 2 deletions
4
...ers/widgets/borrower_search_delegate.dart → ...ns/checkout/borrower_search_delegate.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/librarian/lib/modules/loans/checkout/checkout_details.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
apps/librarian/lib/modules/loans/checkout/checkout_stepper.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters