refactor profile view
This commit is contained in:
parent
d976d9ec22
commit
534e31e634
|
@ -17,57 +17,15 @@ class ProfileView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ProfileViewState extends State<ProfileView> {
|
||||
RelationshipModel? relationship;
|
||||
|
||||
static const d = SizedBox(
|
||||
height: 8,
|
||||
);
|
||||
|
||||
void update() async {
|
||||
final r = await getRelationship(widget.model.identity, widget.model.id);
|
||||
setState(() {
|
||||
relationship = r.values.first;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> c = [
|
||||
Image.network(
|
||||
width: global.getWidth(context),
|
||||
fit: BoxFit.fitWidth,
|
||||
widget.model.header,
|
||||
errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(),
|
||||
),
|
||||
StatusIndicators(
|
||||
model: widget.model,
|
||||
relationship: relationship,
|
||||
),
|
||||
d,
|
||||
DisplayName(
|
||||
account: widget.model,
|
||||
clickable: false,
|
||||
),
|
||||
d,
|
||||
PostTextRenderer(input: widget.model.note),
|
||||
];
|
||||
return SimpleDialog(
|
||||
alignment: Alignment.center,
|
||||
contentPadding: const EdgeInsets.all(24),
|
||||
children: [
|
||||
Container(
|
||||
constraints: global.getConstraints(context),
|
||||
width: global.getWidth(context),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: c,
|
||||
),
|
||||
DropdownButton(items: [], onChanged: null),
|
||||
ProfileViewDisplay(
|
||||
model: widget.model,
|
||||
)
|
||||
],
|
||||
);
|
||||
|
@ -132,3 +90,63 @@ class StatusIndicators extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ProfileViewDisplay extends StatefulWidget {
|
||||
const ProfileViewDisplay({super.key, required this.model});
|
||||
final AccountModel model;
|
||||
|
||||
@override
|
||||
State<ProfileViewDisplay> createState() => _ProfileViewDisplayState();
|
||||
}
|
||||
|
||||
class _ProfileViewDisplayState extends State<ProfileViewDisplay> {
|
||||
RelationshipModel? relationship;
|
||||
|
||||
static const d = SizedBox(
|
||||
height: 8,
|
||||
);
|
||||
|
||||
void update() async {
|
||||
final r = await getRelationship(widget.model.identity, widget.model.id);
|
||||
setState(() {
|
||||
relationship = r.values.first;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> c = [
|
||||
Image.network(
|
||||
width: global.getWidth(context),
|
||||
fit: BoxFit.fitWidth,
|
||||
widget.model.header,
|
||||
errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(),
|
||||
),
|
||||
StatusIndicators(
|
||||
model: widget.model,
|
||||
relationship: relationship,
|
||||
),
|
||||
d,
|
||||
DisplayName(
|
||||
account: widget.model,
|
||||
clickable: false,
|
||||
),
|
||||
d,
|
||||
PostTextRenderer(input: widget.model.note),
|
||||
];
|
||||
return Container(
|
||||
constraints: global.getConstraints(context),
|
||||
width: global.getWidth(context),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: c,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue