Skip to content

Commit

Permalink
fix create button statr
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagocarvalhodev committed Jan 3, 2025
1 parent adf5bab commit c8b99f2
Show file tree
Hide file tree
Showing 5 changed files with 465 additions and 455 deletions.
1 change: 0 additions & 1 deletion deploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
"dependencies": {
"permaweb-deploy": "1.1.6"
}

}
11 changes: 9 additions & 2 deletions lib/arns/presentation/create_undername.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CreateUndernameModal extends StatelessWidget {
fileId,
transactionId,
),
child: CreateUndernameView(),
child: const CreateUndernameView(),
);
}
}
Expand All @@ -44,6 +44,7 @@ class CreateUndernameView extends StatefulWidget {

class _CreateUndernameViewState extends State<CreateUndernameView> {
final controller = TextEditingController();
bool isLoading = false;

@override
void initState() {
Expand All @@ -61,6 +62,9 @@ class _CreateUndernameViewState extends State<CreateUndernameView> {
content: BlocConsumer<CreateUndernameBloc, CreateUndernameState>(
listener: (context, state) {
if (state is CreateUndernameSuccess) {
setState(() {
isLoading = false;
});
context.read<AssignNameBloc>().add(
ShowSuccessModal(
undername: state.undername,
Expand Down Expand Up @@ -100,8 +104,11 @@ class _CreateUndernameViewState extends State<CreateUndernameView> {
title: 'Cancel',
),
ModalAction(
isEnable: controller.text.isNotEmpty,
isEnable: controller.text.isNotEmpty && !isLoading,
action: () {
setState(() {
isLoading = true;
});
context
.read<CreateUndernameBloc>()
.add(CreateNewUndername(controller.text));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:ardrive/arns/domain/arns_repository.dart';
import 'package:ardrive/utils/logger.dart';
import 'package:ario_sdk/ario_sdk.dart';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

part 'create_undername_event.dart';
part 'create_undername_state.dart';
Expand Down Expand Up @@ -35,6 +35,7 @@ class CreateUndernameBloc
);

logger.d('Process ID: ${_nameModel.processId}');

await _arnsRepository.setUndernamesToFile(
undername: undername,
driveId: driveId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class ArioSDKWeb implements ArioSDK {
@override
Future<List<ArNSNameModel>> getArNSNames(String address) {
// TODO: implement getArNSNames
throw UnimplementedError();
}

@override
Future<PrimaryNameDetails> getPrimaryNameDetails(
String address,
bool getLogo,
Expand Down
Loading

0 comments on commit c8b99f2

Please sign in to comment.