Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inlineimagecontroller now has a validation check #1123

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions lib/view/homescreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class _HomeScreenState extends State<HomeScreen>
final TextEditingController inlineimagecontroller =
GetIt.instance.get<InlineImageProvider>().getController();
bool isDialInteracting = false;
String errorVal = "";

@override
void initState() {
Expand Down Expand Up @@ -172,6 +173,8 @@ class _HomeScreenState extends State<HomeScreen>
controller: inlineimagecontroller,
specialTextSpanBuilder: ImageBuilder(),
decoration: InputDecoration(
hintText: errorVal,
hintStyle: TextStyle(color: Colors.red),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.r),
),
Expand Down Expand Up @@ -262,21 +265,31 @@ class _HomeScreenState extends State<HomeScreen>
onTap: () {
logger.i(
'Save button clicked, showing dialog : ${animationProvider.isEffectActive(FlashEffect())}');
showDialog(
context: this.context,
builder: (context) {
return SaveBadgeDialog(
speed: speedDialProvider,
animationProvider:
animationProvider,
textController:
inlineImageProvider
.getController(),
isInverse: animationProvider
.isEffectActive(
InvertLEDEffect()),
);
});
inlineimagecontroller.text == ""
? setState(() {
errorVal =
"Please fill out this field";
})
: {
setState(() {
errorVal = "";
}),
showDialog(
context: this.context,
builder: (context) {
return SaveBadgeDialog(
speed: speedDialProvider,
animationProvider:
animationProvider,
textController:
inlineImageProvider
.getController(),
isInverse: animationProvider
.isEffectActive(
InvertLEDEffect()),
);
})
};
},
child: Container(
padding: EdgeInsets.symmetric(
Expand Down
Loading