This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Second Component Typescript: | |
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; | |
import { Member } from '../app.component'; | |
@Component({ | |
selector: 'app-second', | |
templateUrl: './second.component.html', | |
styleUrls: ['./second.component.scss'], | |
// changeDetection: ChangeDetectionStrategy.OnPush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ColorExtension on String { | |
toColor() { | |
String hexColor = replaceAll('#', ''); | |
if (hexColor.length == 6) { | |
hexColor = 'FF' + hexColor; | |
} | |
if (hexColor.length == 8) { | |
return Color(int.parse('0x$hexColor')); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
@immutable | |
class ItemCard extends StatelessWidget { | |
const ItemCard({ | |
super.key, | |
required this.title, | |
required this.description, | |
this.radius = 20, | |
this.width, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widgets.dart'; | |
@immutable | |
class HideKeyboard extends StatelessWidget { | |
const HideKeyboard({super.key, required this.child}); | |
final Widget child; | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RegExHelper { | |
RegExHelper._(); | |
static final emailPattern = RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+"); | |
static final passwordPattern = RegExp(r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$'); | |
/* | |
r'^ | |
(?=.*[A-Z]) // should contain at least one upper case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class AppSnackBar { | |
static void showSnackBar( | |
BuildContext context, { | |
required String text, | |
bool? success, | |
}) { | |
ScaffoldMessenger.of(context).showSnackBar( | |
SnackBar( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension HttpStatusExtension on int { | |
bool get statusOk => HttpStatus.success.contains(this); | |
} | |
class HttpStatus { | |
const HttpStatus._(); | |
static const ok = 200; | |
static const created = 201; | |
static const accepted = 202; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MacOS: user/Developer/Xcode/DerivedData | |
flutter clean | |
delete /ios/Pods | |
delete /ios/Podfile.lock | |
flutter pub get | |
from inside ios folder: pod install | |
flutter run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
final kIsDesktop = Platform.isWindows || Platform.isMacOS || Platform.isLinux; | |
final kIsMobile = Platform.isAndroid || Platform.isIOS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Based on https://material.io/design/layout/responsive-layout-grid.html#breakpoints | |
class AppBreakPoints { | |
const AppBreakPoints._(); | |
/// extra-small | |
static const xs = 350; | |
/// small | |
static const sm = 600; |
OlderNewer