Cleanup code
This commit is contained in:
parent
99d967463c
commit
fe9de86f98
|
@ -1,52 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class CommentEditor extends StatefulWidget {
|
||||
final String? initValue;
|
||||
final Function(String) onSave;
|
||||
|
||||
const CommentEditor({super.key, this.initValue, required this.onSave});
|
||||
|
||||
@override
|
||||
State<CommentEditor> createState() => _CommentEditorState();
|
||||
}
|
||||
|
||||
class _CommentEditorState extends State<CommentEditor> {
|
||||
final textController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.initValue != null) {
|
||||
setState(() {
|
||||
textController.text = widget.initValue ?? '';
|
||||
});
|
||||
}
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
TextField(
|
||||
controller: textController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(), hintText: 'Type comment here...'),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
widget.onSave(textController.text);
|
||||
},
|
||||
child: const Text('Save'))
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class Avatar extends StatelessWidget {
|
||||
final String image;
|
||||
final String url;
|
||||
final double? radius;
|
||||
|
||||
const Avatar(this.image, {super.key, this.radius});
|
||||
const Avatar(this.url, {super.key, this.radius});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CircleAvatar(
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundImage: NetworkImage(image),
|
||||
backgroundImage: NetworkImage(url),
|
||||
radius: radius,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue