Skip to content

Commit

Permalink
question title use theme
Browse files Browse the repository at this point in the history
  • Loading branch information
goxiaoy committed May 6, 2023
1 parent f585459 commit 901ffa6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
20 changes: 5 additions & 15 deletions lib/ui/elements/question_title.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_survey_js_model/flutter_survey_js_model.dart' as s;
import 'package:flutter_survey_js/ui/survey_widget.dart';
import 'package:flutter_survey_js_model/flutter_survey_js_model.dart' as s;

class QuestionTitle extends StatelessWidget {
final s.Question q;
Expand All @@ -16,38 +16,28 @@ class QuestionTitle extends StatelessWidget {
return Container(
padding: const EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0),
child: Text(q.description!,
style: TextStyle(
fontFamily: 'SF-UI-Text',
color: Theme.of(context).disabledColor //Color(0xff8b9aa9)
)),
style: Theme.of(context).textTheme.bodyMedium),
);
} else {
return Container();
}
}

titleTextStyle() {
return TextStyle(
fontSize: 16.0,
fontFamily: 'SF-UI-Text',
fontWeight: FontWeight.w900,
color: Theme.of(context).disabledColor //Color(0xff242833)
);
}
titleTextStyle() => Theme.of(context).textTheme.titleMedium;

title() {
List<Widget> listTitle = <Widget>[];
listTitle.add(Builder(builder: (context) {
final survey = SurveyProvider.of(context);
final status = survey.elementsState.get(q);
if (status != null) {
if (survey.survey.showQuestionNumbers == "on" &&
if ((survey.survey.showQuestionNumbers?.isOn ?? false) &&
status.indexAll != null) {
return Text(
'${status.indexAll! + 1}.',
style: titleTextStyle(),
);
} else if (survey.survey.showQuestionNumbers == "onPage" &&
} else if ((survey.survey.showQuestionNumbers?.isOnPage ?? false) &&
status.indexInPage != null) {
return Text(
'${status.indexInPage! + 1}.',
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/elements/ranking.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import 'package:flutter_survey_js_model/flutter_survey_js_model.dart' as s;
import 'package:reactive_forms/reactive_forms.dart';

import 'question_title.dart';
import 'survey_element_factory.dart';

final SurveyElementBuilder rankingBuilder =
(context, element, {bool hasTitle = true}) {
Widget rankingBuilder(context, element, {bool hasTitle = true}) {
return RankingElement(
formControlName: element.name!,
element: element as s.Ranking,
).wrapQuestionTitle(element, hasTitle: hasTitle);
};
}

class RankingElement extends StatelessWidget {
final String formControlName;
Expand Down

0 comments on commit 901ffa6

Please sign in to comment.