Skip to content

Commit

Permalink
Implement ComponentConstants & Finalize NomoInput
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2-nomo committed Nov 29, 2023
1 parent d6bd44e commit cc14b11
Show file tree
Hide file tree
Showing 29 changed files with 997 additions and 226 deletions.
3 changes: 3 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import 'package:http/http.dart';
import 'package:markdown_widget/markdown_widget.dart';
import 'package:nomo_ui_kit/app/nomo_app.dart';
import 'package:nomo_ui_kit/components/app/routebody/nomo_route_body.dart';
import 'package:nomo_ui_kit/components/input/textInput/nomo_input.dart';
import 'package:nomo_ui_kit/theme/nomo_theme.dart';
// ignore: depend_on_referenced_packages
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:nomo_ui_kit/theme/sub/nomo_constants.dart';

void main() {
// const savedColorMode = ColorMode.LIGHT;
Expand All @@ -32,6 +34,7 @@ class MyApp extends StatelessWidget {
colorTheme: ColorMode.LIGHT.theme,
sizingTheme: SizingMode.LARGE.theme,
textTheme: typography,
constants: constants,
),
supportedLocales: const [Locale('en', 'US')],
routes: routes,
Expand Down
31 changes: 28 additions & 3 deletions example/lib/sections/input_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,25 @@ import 'package:nomo_ui_kit/icons/nomo_icons.dart';
import 'package:nomo_ui_kit/theme/nomo_theme.dart';
import 'package:nomo_ui_kit/utils/layout_extensions.dart';

class InputSection extends StatelessWidget {
class InputSection extends StatefulWidget {
const InputSection({Key? key}) : super(key: key);

@override
State<InputSection> createState() => _InputSectionState();
}

class _InputSectionState extends State<InputSection> {
late final ValueNotifier<String> amount = ValueNotifier('')
..addListener(() {
// print("Amount changed ${amount.value}");
});

@override
void dispose() {
amount.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return NomoRouteBody(
Expand All @@ -35,7 +51,7 @@ class InputSection extends StatelessWidget {
keyboardType: TextInputType.number,
style: context.typography.b3,
borderRadius: const BorderRadius.vertical(top: Radius.circular(12), bottom: Radius.circular(4)),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
placeHolder: "Amount",
usePlaceholderAsTitle: true,
minLines: 1,
Expand All @@ -44,6 +60,15 @@ class InputSection extends StatelessWidget {
color: context.colors.foreground1,
size: 18,
),
valueNotifier: amount,
validator: (value) {
if (value.isEmpty) {
return "Value cannot be empty";
}
if (value.length < 3) {
return "Value to small";
}
},
trailling: PrimaryNomoButton(
backgroundColor: context.colors.primary,
text: "max",
Expand All @@ -52,7 +77,7 @@ class InputSection extends StatelessWidget {
elevation: 0,
borderRadius: BorderRadius.circular(12),
onPressed: () {
print("max");
amount.value = "Max";
},
),
),
Expand Down
8 changes: 8 additions & 0 deletions example/lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:nomo_ui_kit/components/app/app.dart';
import 'package:nomo_ui_kit/components/input/textInput/nomo_input.dart';
import 'package:nomo_ui_kit/components/outline_container/nomo_outline_container.dart';
import 'package:nomo_ui_kit/theme/nomo_theme.dart';
import 'package:nomo_ui_kit/theme/sub/nomo_color_theme.dart';
import 'package:nomo_ui_kit/theme/sub/nomo_constants.dart';
import 'package:nomo_ui_kit/theme/sub/nomo_sizing_theme.dart';

final typography = NomoTypographyTheme(
Expand All @@ -17,6 +19,12 @@ final typography = NomoTypographyTheme(
h3: GoogleFonts.nunito(),
);

const constants = NomoComponentConstants(
inputTheme: NomoInputConstants(
duration: Duration(milliseconds: 200),
),
);

enum ColorMode {
LIGHT('Nomo Light', "assets/images/light/registrationbackground.png"),
DARK('Nomo Dark', "assets/images/dark/registrationbackground.png"),
Expand Down
24 changes: 19 additions & 5 deletions lib/components/app/app_bar/nomo_app_bar.theme_data.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions lib/components/app/bottom_bar/nomo_bottom_bar.theme_data.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions lib/components/app/routebody/nomo_route_body.theme_data.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions lib/components/app/scaffold/nomo_scaffold.theme_data.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions lib/components/app/sider/nomo_sider.theme_data.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cc14b11

Please sign in to comment.