Skip to content

Commit

Permalink
Rename dao widget
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHanafy725 committed Sep 19, 2024
1 parent 77a2239 commit 1e0b261
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions app/lib/screens/dao_screen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:tfchain_client/models/dao.dart';
import 'package:threebotlogin/widgets/layout_drawer.dart';
import 'package:threebotlogin/widgets/dao/active_executable_widget.dart';
import 'package:threebotlogin/widgets/dao/proposals.dart';
import 'package:threebotlogin/services/tfchain_service.dart';

class DaoPage extends StatefulWidget {
Expand All @@ -20,6 +20,7 @@ class _DaoPageState extends State<DaoPage> {
setState(() {
loading = true;
});
// TODO: show error in case of failure
final proposals = await getProposals();
activeList.addAll(proposals['activeProposals']!);
inactiveList.addAll(proposals['inactiveProposals']!);
Expand Down Expand Up @@ -77,8 +78,8 @@ class _DaoPageState extends State<DaoPage> {
Expanded(
child: TabBarView(
children: [
ActiveOrExecutableWidget(proposals: activeList, active: true),
ActiveOrExecutableWidget(
ProposalsWidget(proposals: activeList, active: true),
ProposalsWidget(
proposals: inactiveList,
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import 'package:tfchain_client/models/dao.dart';

import 'dao_card.dart';

class ActiveOrExecutableWidget extends StatefulWidget {
class ProposalsWidget extends StatefulWidget {
final List<Proposal>? proposals;
final bool active;
const ActiveOrExecutableWidget(
const ProposalsWidget(
{super.key, required this.proposals, this.active = false});

@override
State<ActiveOrExecutableWidget> createState() =>
_ActiveOrExecutableWidgetState();
State<ProposalsWidget> createState() => _ProposalsWidgetState();
}

class _ActiveOrExecutableWidgetState extends State<ActiveOrExecutableWidget> {
class _ProposalsWidgetState extends State<ProposalsWidget> {
List<Proposal>? proposals = [];

@override
Expand All @@ -24,7 +23,7 @@ class _ActiveOrExecutableWidgetState extends State<ActiveOrExecutableWidget> {
}

@override
void didUpdateWidget(covariant ActiveOrExecutableWidget oldWidget) {
void didUpdateWidget(covariant ProposalsWidget oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.proposals != oldWidget.proposals) {
setState(() {
Expand Down

0 comments on commit 1e0b261

Please sign in to comment.