diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 31a5ec76..eb419deb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,13 +7,13 @@ name: Tests on: push: - branches: [ main ] + branches: [ main, develop ] pull_request: - branches: [ main ] + branches: [ main, develop ] jobs: build: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index acc398af..3a3263b8 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,6 @@ build/ .flutter-plugins .flutter-plugins-dependencies .fvm/ +coverage/html +test/**/failures .vscode/settings.json diff --git a/.vscode/launch.json b/.vscode/launch.json index dba661dd..f2b0166c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -23,6 +23,15 @@ "request": "launch", "type": "dart", "flutterMode": "release" - } + }, + { + "name": "Golden", + "request": "launch", + "type": "dart", + "codeLens": { + "for": ["run-test", "run-test-file"] + }, + "args": ["--update-goldens"] + } ] } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index dc458f0f..8ff23995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.0.17 + +* Added unit e goldens tests +* Added support for email in text +* Added suport for Carousel message bubble + ## 0.0.16 * Added support for design system Toast diff --git a/assets/fonts/DSIcons.ttf b/assets/fonts/DSIcons.ttf index 51988343..d75ac2f1 100644 Binary files a/assets/fonts/DSIcons.ttf and b/assets/fonts/DSIcons.ttf differ diff --git a/assets/images/blip_ balloon.svg b/assets/images/blip_ balloon.svg new file mode 100644 index 00000000..fc3f6112 --- /dev/null +++ b/assets/images/blip_ balloon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/clip.png b/assets/images/clip.png deleted file mode 100644 index 28679e64..00000000 Binary files a/assets/images/clip.png and /dev/null differ diff --git a/assets/images/file-csv.png b/assets/images/file-csv.png deleted file mode 100644 index 4df1141a..00000000 Binary files a/assets/images/file-csv.png and /dev/null differ diff --git a/assets/images/file-default.png b/assets/images/file-default.png deleted file mode 100644 index f42dbbc3..00000000 Binary files a/assets/images/file-default.png and /dev/null differ diff --git a/assets/images/file-doc.png b/assets/images/file-doc.png deleted file mode 100644 index 5fa1de7c..00000000 Binary files a/assets/images/file-doc.png and /dev/null differ diff --git a/assets/images/file-pdf.png b/assets/images/file-pdf.png deleted file mode 100644 index c8202366..00000000 Binary files a/assets/images/file-pdf.png and /dev/null differ diff --git a/assets/images/file-ppt.png b/assets/images/file-ppt.png deleted file mode 100644 index 9134d6ab..00000000 Binary files a/assets/images/file-ppt.png and /dev/null differ diff --git a/assets/images/file-txt.png b/assets/images/file-txt.png deleted file mode 100644 index 4d54660f..00000000 Binary files a/assets/images/file-txt.png and /dev/null differ diff --git a/assets/images/file-xls.png b/assets/images/file-xls.png deleted file mode 100644 index d2301ecf..00000000 Binary files a/assets/images/file-xls.png and /dev/null differ diff --git a/assets/images/file-zip.png b/assets/images/file-zip.png deleted file mode 100644 index 7507a4b0..00000000 Binary files a/assets/images/file-zip.png and /dev/null differ diff --git a/assets/images/icon_bell.svg b/assets/images/icon_bell.svg deleted file mode 100644 index 901d65c6..00000000 --- a/assets/images/icon_bell.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/icon_error.svg b/assets/images/icon_error.svg deleted file mode 100644 index 554c18be..00000000 --- a/assets/images/icon_error.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/icon_like.svg b/assets/images/icon_like.svg deleted file mode 100644 index 93870892..00000000 --- a/assets/images/icon_like.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/icon_message.svg b/assets/images/icon_message.svg deleted file mode 100644 index ebcafefb..00000000 --- a/assets/images/icon_message.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/icon_warning.svg b/assets/images/icon_warning.svg deleted file mode 100644 index 59a46dd6..00000000 --- a/assets/images/icon_warning.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/notificacao.png b/assets/images/notificacao.png deleted file mode 100644 index e7a95773..00000000 Binary files a/assets/images/notificacao.png and /dev/null differ diff --git a/assets/images/send_button.png b/assets/images/send_button.png deleted file mode 100644 index f457bc86..00000000 Binary files a/assets/images/send_button.png and /dev/null differ diff --git a/coverage/lcov.info b/coverage/lcov.info new file mode 100644 index 00000000..85ea9f37 --- /dev/null +++ b/coverage/lcov.info @@ -0,0 +1,2009 @@ +SF:lib/src/widgets/chat/ds_delivery_report_icon.widget.dart +DA:10,1 +DA:13,1 +DA:15,1 +DA:17,1 +DA:20,1 +DA:23,1 +DA:24,1 +DA:25,1 +DA:30,1 +DA:31,1 +DA:32,1 +DA:36,1 +DA:37,1 +DA:46,1 +DA:48,1 +DA:49,1 +DA:50,1 +DA:58,1 +DA:59,1 +DA:65,1 +DA:66,1 +LF:21 +LH:21 +end_of_record +SF:lib/src/utils/ds_linkify.util.dart +DA:8,1 +DA:13,1 +DA:14,1 +DA:20,1 +DA:25,1 +DA:27,1 +DA:28,1 +DA:29,1 +DA:30,1 +DA:32,1 +DA:33,1 +DA:40,2 +DA:41,1 +DA:42,1 +DA:43,1 +DA:44,1 +DA:49,0 +DA:50,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:58,0 +DA:62,0 +DA:80,0 +DA:81,0 +DA:88,0 +DA:89,0 +DA:90,0 +DA:91,0 +DA:96,0 +DA:99,0 +LF:32 +LH:16 +end_of_record +SF:lib/src/widgets/chat/ds_message_bubble.widget.dart +DA:19,0 +DA:32,0 +DA:34,0 +DA:35,0 +DA:41,0 +DA:42,0 +DA:44,0 +DA:45,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:51,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:60,0 +DA:61,0 +DA:62,0 +DA:70,0 +DA:72,0 +DA:73,0 +DA:75,0 +DA:76,0 +DA:77,0 +DA:80,0 +LF:28 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_text_message_bubble.widget.dart +DA:21,0 +DA:30,0 +DA:31,0 +DA:33,0 +DA:34,0 +DA:41,0 +DA:43,0 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,0 +DA:56,0 +DA:58,0 +DA:59,0 +DA:60,0 +DA:62,0 +DA:63,0 +DA:67,0 +DA:68,0 +DA:72,0 +DA:74,0 +DA:75,0 +DA:76,0 +DA:78,0 +DA:79,0 +DA:80,0 +DA:83,0 +DA:86,0 +DA:87,0 +DA:88,0 +DA:90,0 +DA:91,0 +DA:92,0 +DA:93,0 +DA:94,0 +DA:95,0 +DA:96,0 +DA:99,0 +DA:100,0 +DA:101,0 +DA:102,0 +DA:103,0 +DA:104,0 +LF:43 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_file_message_bubble.widget.dart +DA:25,0 +DA:33,0 +DA:34,0 +DA:36,0 +DA:38,0 +DA:39,0 +DA:40,0 +DA:41,0 +DA:43,0 +DA:44,0 +DA:45,0 +DA:47,0 +DA:49,0 +DA:50,0 +DA:51,0 +DA:59,0 +DA:60,0 +DA:63,0 +DA:64,0 +DA:68,0 +DA:70,0 +DA:71,0 +DA:72,0 +DA:75,0 +DA:86,0 +DA:87,0 +DA:91,0 +DA:92,0 +DA:100,0 +DA:102,0 +DA:103,0 +DA:104,0 +DA:108,0 +DA:109,0 +LF:34 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_image_message_bubble.widget.dart +DA:35,0 +DA:49,0 +DA:50,0 +DA:52,0 +DA:54,0 +DA:58,0 +DA:61,0 +DA:62,0 +DA:64,0 +DA:65,0 +DA:66,0 +DA:67,0 +DA:68,0 +DA:70,0 +DA:72,0 +DA:74,0 +DA:76,0 +DA:78,0 +DA:79,0 +DA:80,0 +DA:82,0 +DA:83,0 +DA:84,0 +DA:85,0 +DA:86,0 +DA:87,0 +DA:92,0 +DA:93,0 +DA:94,0 +DA:95,0 +DA:99,0 +DA:103,0 +DA:106,0 +DA:107,0 +DA:111,0 +DA:112,0 +DA:113,0 +DA:117,0 +DA:118,0 +DA:119,0 +DA:121,0 +DA:123,0 +DA:125,0 +DA:126,0 +DA:127,0 +DA:128,0 +DA:131,0 +DA:132,0 +DA:136,0 +DA:137,0 +DA:138,0 +DA:139,0 +DA:140,0 +DA:141,0 +DA:148,0 +DA:149,0 +DA:150,0 +DA:151,0 +DA:152,0 +DA:153,0 +DA:166,0 +DA:167,0 +DA:169,0 +DA:176,0 +DA:177,0 +DA:179,0 +DA:180,0 +DA:181,0 +DA:182,0 +DA:184,0 +DA:186,0 +DA:187,0 +DA:189,0 +DA:190,0 +DA:191,0 +DA:194,0 +DA:201,0 +DA:202,0 +DA:204,0 +DA:205,0 +DA:206,0 +DA:208,0 +DA:209,0 +DA:218,0 +DA:219,0 +DA:220,0 +DA:221,0 +DA:222,0 +DA:225,0 +DA:227,0 +DA:228,0 +DA:230,0 +DA:231,0 +LF:93 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart +DA:18,0 +DA:25,0 +DA:26,0 +DA:28,0 +DA:30,0 +DA:34,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:38,0 +DA:40,0 +DA:41,0 +DA:42,0 +DA:44,0 +DA:49,0 +DA:51,0 +DA:52,0 +LF:17 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_url_preview.widget.dart +DA:20,0 +DA:32,0 +DA:34,0 +DA:36,0 +DA:38,0 +DA:39,0 +DA:40,0 +DA:41,0 +DA:45,0 +DA:47,0 +DA:50,0 +DA:51,0 +DA:54,0 +DA:56,0 +DA:57,0 +DA:58,0 +DA:65,0 +DA:66,0 +DA:68,0 +DA:69,0 +DA:74,0 +DA:75,0 +DA:76,0 +DA:77,0 +DA:79,0 +DA:80,0 +DA:82,0 +DA:83,0 +DA:84,0 +DA:85,0 +DA:87,0 +DA:88,0 +DA:89,0 +DA:96,0 +DA:99,0 +DA:103,0 +DA:104,0 +DA:108,0 +DA:112,0 +DA:113,0 +DA:114,0 +DA:116,0 +DA:117,0 +DA:118,0 +DA:120,0 +DA:123,0 +DA:124,0 +DA:126,0 +LF:48 +LH:0 +end_of_record +SF:lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart +DA:23,0 +DA:29,0 +DA:30,0 +DA:32,0 +DA:33,0 +DA:40,0 +DA:42,0 +DA:44,0 +DA:47,0 +DA:49,0 +DA:50,0 +DA:51,0 +DA:54,0 +DA:56,0 +DA:57,0 +DA:61,0 +DA:64,0 +DA:66,0 +DA:68,0 +DA:70,0 +DA:71,0 +DA:72,0 +DA:73,0 +DA:75,0 +DA:76,0 +DA:77,0 +DA:78,0 +DA:79,0 +DA:80,0 +DA:82,0 +DA:83,0 +DA:102,0 +DA:103,0 +DA:104,0 +DA:105,0 +DA:106,0 +DA:110,0 +DA:111,0 +DA:114,0 +DA:115,0 +DA:119,0 +DA:120,0 +DA:121,0 +DA:122,0 +DA:123,0 +DA:124,0 +DA:125,0 +DA:126,0 +DA:127,0 +DA:130,0 +DA:134,0 +DA:135,0 +DA:136,0 +DA:137,0 +DA:141,0 +DA:142,0 +DA:143,0 +DA:153,0 +DA:154,0 +DA:155,0 +DA:156,0 +DA:157,0 +DA:158,0 +DA:162,0 +DA:163,0 +DA:164,0 +DA:165,0 +DA:166,0 +DA:167,0 +DA:168,0 +DA:169,0 +DA:170,0 +LF:72 +LH:0 +end_of_record +SF:lib/src/widgets/fields/ds_text_form_field.widget.dart +DA:6,0 +DA:28,0 +DA:29,0 +DA:30,0 +DA:31,0 +DA:32,0 +DA:35,0 +DA:39,0 +DA:41,0 +DA:44,0 +DA:45,0 +DA:47,0 +DA:50,0 +DA:51,0 +DA:52,0 +DA:56,0 +DA:57,0 +DA:58,0 +DA:60,0 +DA:67,0 +DA:73,0 +DA:74,0 +DA:75,0 +DA:76,0 +DA:80,0 +DA:81,0 +DA:83,0 +DA:87,0 +LF:28 +LH:0 +end_of_record +SF:lib/src/widgets/animations/ds_animated_size.widget.dart +DA:7,2 +DA:10,2 +LF:2 +LH:2 +end_of_record +SF:lib/src/widgets/animations/ds_fading_circle_loading.widget.dart +DA:10,7 +DA:14,1 +DA:16,1 +DA:18,1 +DA:19,1 +DA:20,1 +LF:6 +LH:6 +end_of_record +SF:lib/src/widgets/animations/ds_ring_loading.widget.dart +DA:11,2 +DA:16,2 +DA:18,2 +DA:20,2 +DA:21,2 +DA:22,2 +DA:23,2 +LF:7 +LH:7 +end_of_record +SF:lib/src/widgets/buttons/ds_button.widget.dart +DA:26,1 +DA:40,1 +DA:42,1 +DA:44,1 +DA:45,3 +DA:46,1 +DA:47,2 +DA:49,1 +DA:50,1 +DA:51,1 +DA:57,2 +DA:59,1 +DA:60,1 +DA:61,2 +DA:63,1 +DA:64,1 +DA:66,1 +DA:67,2 +DA:70,1 +DA:71,1 +DA:73,1 +DA:79,1 +DA:80,2 +DA:82,1 +DA:83,1 +DA:85,1 +DA:86,1 +DA:87,1 +DA:90,1 +DA:93,1 +DA:94,2 +DA:95,1 +DA:96,1 +DA:101,1 +DA:102,1 +DA:103,3 +DA:107,1 +DA:108,1 +DA:109,2 +DA:110,1 +DA:111,1 +DA:112,1 +DA:113,1 +DA:120,1 +DA:121,1 +DA:122,3 +DA:126,1 +DA:127,2 +DA:129,3 +DA:132,1 +DA:133,4 +DA:134,2 +LF:52 +LH:52 +end_of_record +SF:lib/src/widgets/buttons/ds_primary_button.widget.dart +DA:11,1 +DA:19,1 +LF:2 +LH:2 +end_of_record +SF:lib/src/widgets/buttons/ds_secondary_button.widget.dart +DA:11,1 +DA:19,1 +LF:2 +LH:2 +end_of_record +SF:lib/src/widgets/buttons/ds_tertiary_button.widget.dart +DA:12,1 +DA:20,1 +LF:2 +LH:2 +end_of_record +SF:lib/src/widgets/buttons/ds_send_button.widget.dart +DA:9,0 +DA:14,0 +LF:2 +LH:0 +end_of_record +SF:lib/src/widgets/buttons/ds_icon_button.widget.dart +DA:9,0 +DA:14,0 +DA:16,0 +DA:18,0 +LF:4 +LH:0 +end_of_record +SF:lib/src/widgets/buttons/ds_attachment_button.widget.dart +DA:5,0 +DA:9,0 +LF:2 +LH:0 +end_of_record +SF:lib/src/widgets/texts/ds_body_text.widget.dart +DA:9,0 +DA:20,0 +DA:21,0 +DA:29,0 +DA:40,0 +DA:41,0 +LF:6 +LH:0 +end_of_record +SF:lib/src/widgets/texts/ds_headline_large_text.widget.dart +DA:9,0 +DA:16,0 +DA:20,0 +DA:27,0 +LF:4 +LH:0 +end_of_record +SF:lib/src/widgets/texts/ds_headline_small_text.widget.dart +DA:9,0 +DA:17,0 +DA:18,0 +DA:23,0 +DA:31,0 +DA:32,0 +LF:6 +LH:0 +end_of_record +SF:lib/src/widgets/texts/ds_caption_text.widget.dart +DA:9,0 +DA:19,0 +DA:20,0 +DA:27,0 +DA:37,0 +DA:38,0 +LF:6 +LH:0 +end_of_record +SF:lib/src/widgets/texts/ds_caption_small_text.widget.dart +DA:9,1 +DA:18,1 +DA:19,1 +DA:25,0 +DA:34,0 +DA:35,0 +LF:6 +LH:3 +end_of_record +SF:lib/src/widgets/texts/ds_button_text.widget.dart +DA:9,1 +DA:15,1 +DA:16,1 +DA:22,0 +DA:28,0 +DA:29,0 +LF:6 +LH:3 +end_of_record +SF:lib/src/widgets/utils/ds_cached_network_image_view.widget.dart +DA:25,0 +DA:36,0 +DA:37,0 +DA:39,0 +DA:41,0 +DA:42,0 +DA:43,0 +DA:44,0 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:50,0 +DA:55,0 +DA:56,0 +DA:58,0 +DA:59,0 +DA:60,0 +DA:63,0 +DA:64,0 +DA:66,0 +DA:68,0 +LF:23 +LH:0 +end_of_record +SF:lib/src/widgets/utils/ds_user_avatar.widget.dart +DA:12,0 +DA:19,0 +DA:21,0 +DA:23,0 +DA:24,0 +DA:25,0 +DA:26,0 +DA:27,0 +DA:28,0 +DA:31,0 +DA:32,0 +DA:34,0 +DA:37,0 +DA:40,0 +DA:42,0 +DA:43,0 +DA:44,0 +DA:45,0 +DA:46,0 +DA:48,0 +DA:49,0 +DA:50,0 +DA:57,0 +DA:58,0 +DA:59,0 +LF:25 +LH:0 +end_of_record +SF:lib/src/widgets/utils/ds_group_card.widget.dart +DA:17,0 +DA:18,0 +DA:21,0 +DA:22,0 +DA:23,0 +DA:24,0 +DA:29,0 +DA:30,0 +DA:31,0 +DA:33,0 +DA:34,0 +DA:41,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:69,0 +DA:71,0 +DA:73,0 +DA:74,0 +DA:78,0 +DA:79,0 +DA:84,0 +DA:85,0 +DA:87,0 +DA:88,0 +DA:91,0 +DA:92,0 +DA:95,0 +DA:96,0 +DA:98,0 +DA:101,0 +DA:102,0 +DA:105,0 +DA:106,0 +DA:107,0 +DA:109,0 +DA:111,0 +DA:112,0 +DA:113,0 +DA:114,0 +DA:116,0 +DA:117,0 +DA:118,0 +DA:119,0 +DA:122,0 +DA:124,0 +DA:125,0 +DA:127,0 +DA:132,0 +DA:133,0 +DA:134,0 +DA:136,0 +DA:140,0 +DA:143,0 +DA:144,0 +DA:146,0 +DA:147,0 +DA:153,0 +DA:154,0 +DA:155,0 +DA:160,0 +DA:161,0 +DA:163,0 +DA:164,0 +DA:165,0 +DA:166,0 +DA:167,0 +DA:168,0 +DA:173,0 +DA:174,0 +DA:175,0 +DA:180,0 +DA:181,0 +DA:182,0 +DA:187,0 +DA:189,0 +DA:190,0 +DA:194,0 +DA:198,0 +DA:200,0 +DA:207,0 +DA:210,0 +DA:211,0 +DA:212,0 +DA:213,0 +DA:214,0 +DA:220,0 +DA:221,0 +DA:222,0 +DA:224,0 +DA:228,0 +DA:229,0 +DA:235,0 +DA:237,0 +DA:240,0 +DA:241,0 +DA:248,0 +DA:252,0 +DA:253,0 +DA:255,0 +DA:256,0 +DA:259,0 +DA:260,0 +DA:261,0 +DA:262,0 +DA:267,0 +DA:268,0 +DA:269,0 +DA:270,0 +DA:271,0 +DA:272,0 +DA:275,0 +DA:276,0 +DA:278,0 +DA:280,0 +DA:281,0 +DA:282,0 +DA:283,0 +DA:284,0 +DA:286,0 +DA:288,0 +DA:289,0 +DA:290,0 +DA:291,0 +DA:292,0 +DA:293,0 +DA:297,0 +DA:301,0 +DA:306,0 +DA:307,0 +DA:308,0 +DA:310,0 +DA:311,0 +DA:313,0 +DA:314,0 +DA:319,0 +DA:325,0 +DA:326,0 +DA:331,0 +DA:337,0 +DA:338,0 +DA:342,0 +LF:142 +LH:0 +end_of_record +SF:lib/src/widgets/utils/ds_header.widget.dart +DA:19,0 +DA:29,0 +DA:31,0 +DA:33,0 +DA:39,0 +DA:42,0 +DA:43,0 +DA:47,0 +DA:50,0 +DA:51,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:62,0 +DA:63,0 +DA:66,0 +DA:67,0 +DA:68,0 +DA:75,0 +DA:76,0 +DA:77,0 +DA:78,0 +DA:81,0 +DA:91,0 +DA:92,0 +LF:27 +LH:0 +end_of_record +SF:lib/src/extensions/ds_border_radius.extension.dart +DA:6,0 +DA:10,0 +DA:19,0 +DA:23,0 +DA:24,0 +DA:26,0 +DA:27,0 +DA:28,0 +DA:29,0 +DA:32,0 +DA:35,0 +DA:38,0 +LF:12 +LH:0 +end_of_record +SF:lib/src/extensions/ds_delivery_report_status.extension.dart +DA:4,0 +DA:5,0 +DA:6,0 +LF:3 +LH:0 +end_of_record +SF:lib/src/themes/texts/ds_text_theme.theme.dart +DA:13,0 +DA:14,0 +LF:2 +LH:0 +end_of_record +SF:lib/src/themes/texts/styles/ds_headline_large_text_style.theme.dart +DA:10,6 +DA:11,0 +LF:2 +LH:1 +end_of_record +SF:lib/src/themes/texts/styles/ds_headline_small_text_style.theme.dart +DA:10,3 +DA:12,0 +LF:2 +LH:1 +end_of_record +SF:lib/src/themes/texts/styles/ds_caption_small_text_style.theme.dart +DA:10,4 +DA:13,1 +LF:2 +LH:2 +end_of_record +SF:lib/src/themes/texts/styles/ds_body_text_style.theme.dart +DA:11,6 +DA:16,0 +LF:2 +LH:1 +end_of_record +SF:lib/src/themes/texts/styles/ds_button_text_style.theme.dart +DA:9,4 +DA:11,1 +LF:2 +LH:2 +end_of_record +SF:lib/src/themes/texts/styles/ds_caption_text_style.theme.dart +DA:7,3 +DA:11,0 +LF:2 +LH:1 +end_of_record +SF:lib/src/services/ds_dialog.service.dart +DA:20,0 +DA:28,0 +DA:29,0 +DA:30,0 +DA:33,0 +DA:37,0 +DA:38,0 +DA:39,0 +DA:41,0 +DA:45,0 +DA:47,0 +DA:49,0 +DA:56,0 +DA:61,0 +DA:62,0 +DA:63,0 +DA:68,0 +DA:70,0 +DA:78,0 +DA:79,0 +DA:81,0 +DA:82,0 +DA:88,0 +DA:89,0 +DA:91,0 +DA:93,0 +DA:94,0 +DA:95,0 +DA:96,0 +DA:102,0 +DA:110,0 +DA:111,0 +DA:112,0 +DA:113,0 +DA:114,0 +DA:116,0 +DA:118,0 +DA:121,0 +DA:122,0 +DA:123,0 +DA:129,0 +DA:132,0 +DA:133,0 +DA:134,0 +DA:135,0 +DA:144,0 +DA:145,0 +DA:149,0 +DA:150,0 +DA:154,0 +DA:155,0 +LF:51 +LH:0 +end_of_record +SF:lib/src/models/ds_message_item.model.dart +DA:33,0 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:50,0 +DA:51,0 +DA:52,0 +DA:53,0 +DA:56,0 +DA:57,0 +DA:60,0 +DA:61,0 +LF:14 +LH:0 +end_of_record +SF:lib/src/models/ds_message_bubble_style.model.dart +DA:15,0 +DA:19,0 +DA:21,0 +DA:22,0 +DA:24,0 +DA:25,0 +DA:26,0 +DA:28,0 +DA:29,0 +DA:30,0 +DA:31,0 +DA:33,0 +DA:34,0 +DA:36,0 +DA:37,0 +DA:38,0 +DA:39,0 +DA:41,0 +LF:18 +LH:0 +end_of_record +SF:lib/src/models/ds_message_bubble_avatar_config.model.dart +DA:7,3 +DA:14,0 +DA:15,0 +LF:3 +LH:1 +end_of_record +SF:lib/src/widgets/chat/typing/ds_typing_message_bubble.widget.dart +DA:16,0 +DA:20,0 +DA:21,0 +DA:23,0 +DA:25,0 +DA:26,0 +DA:27,0 +DA:28,0 +DA:29,0 +LF:9 +LH:0 +end_of_record +SF:lib/src/widgets/chat/typing/ds_typing_dot_animation.widget.dart +DA:20,0 +DA:28,0 +DA:30,0 +DA:31,0 +DA:40,0 +DA:42,0 +DA:43,0 +DA:46,0 +DA:48,0 +DA:49,0 +DA:51,0 +DA:54,0 +DA:56,0 +DA:58,0 +DA:59,0 +DA:60,0 +DA:61,0 +DA:62,0 +DA:63,0 +DA:64,0 +DA:65,0 +DA:66,0 +DA:67,0 +DA:68,0 +DA:69,0 +DA:70,0 +DA:77,0 +DA:82,0 +DA:83,0 +DA:84,0 +DA:85,0 +DA:86,0 +DA:88,0 +DA:91,0 +DA:93,0 +DA:94,0 +DA:95,0 +DA:97,0 +DA:98,0 +DA:99,0 +DA:104,0 +DA:105,0 +DA:106,0 +DA:107,0 +DA:108,0 +DA:109,0 +DA:111,0 +DA:112,0 +DA:115,0 +DA:116,0 +DA:118,0 +DA:119,0 +DA:120,0 +DA:125,0 +LF:54 +LH:0 +end_of_record +SF:lib/src/widgets/switch/ds_switch_tile.widget.dart +DA:10,0 +DA:18,0 +DA:29,0 +DA:31,0 +DA:32,0 +DA:33,0 +DA:34,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:38,0 +DA:39,0 +DA:41,0 +LF:13 +LH:0 +end_of_record +SF:lib/src/widgets/switch/ds_switch.widget.dart +DA:8,0 +DA:13,0 +DA:26,0 +DA:28,0 +DA:29,0 +DA:30,0 +DA:32,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:39,0 +DA:40,0 +DA:44,0 +DA:47,0 +DA:49,0 +DA:50,0 +DA:51,0 +DA:66,0 +DA:67,0 +DA:68,0 +DA:69,0 +DA:70,0 +DA:71,0 +DA:73,0 +LF:24 +LH:0 +end_of_record +SF:lib/src/widgets/radio/ds_radio.widget.dart +DA:36,0 +DA:42,0 +DA:49,0 +DA:52,0 +DA:53,0 +DA:60,0 +DA:61,0 +DA:63,0 +DA:67,0 +DA:72,0 +DA:74,0 +DA:75,0 +DA:76,0 +DA:80,0 +DA:82,0 +DA:83,0 +DA:86,0 +DA:88,0 +DA:90,0 +DA:91,0 +DA:93,0 +DA:94,0 +DA:96,0 +DA:97,0 +DA:98,0 +DA:101,0 +DA:102,0 +DA:108,0 +DA:109,0 +DA:110,0 +DA:111,0 +DA:112,0 +DA:114,0 +DA:115,0 +DA:117,0 +DA:121,0 +DA:123,0 +DA:124,0 +DA:126,0 +DA:127,0 +DA:128,0 +DA:129,0 +DA:130,0 +DA:131,0 +DA:134,0 +DA:137,0 +DA:142,0 +DA:145,0 +DA:146,0 +DA:147,0 +DA:148,0 +DA:149,0 +DA:150,0 +DA:154,0 +DA:158,0 +DA:159,0 +DA:160,0 +DA:162,0 +DA:163,0 +DA:164,0 +DA:165,0 +DA:167,0 +DA:168,0 +DA:169,0 +DA:170,0 +DA:172,0 +DA:174,0 +DA:175,0 +DA:176,0 +DA:177,0 +DA:179,0 +DA:181,0 +DA:182,0 +DA:183,0 +DA:184,0 +DA:187,0 +DA:189,0 +DA:190,0 +DA:191,0 +DA:194,0 +DA:196,0 +DA:197,0 +DA:198,0 +DA:200,0 +DA:202,0 +DA:203,0 +DA:204,0 +DA:205,0 +DA:208,0 +DA:209,0 +DA:210,0 +DA:211,0 +DA:212,0 +DA:213,0 +DA:214,0 +DA:215,0 +DA:216,0 +DA:217,0 +DA:218,0 +DA:220,0 +DA:221,0 +DA:222,0 +DA:223,0 +DA:224,0 +DA:237,0 +DA:239,0 +DA:241,0 +DA:243,0 +DA:245,0 +DA:246,0 +DA:247,0 +DA:248,0 +DA:249,0 +DA:252,0 +DA:253,0 +DA:255,0 +DA:256,0 +DA:260,0 +DA:261,0 +DA:262,0 +DA:265,0 +DA:266,0 +DA:267,0 +DA:268,0 +DA:269,0 +DA:271,0 +DA:274,0 +DA:275,0 +DA:276,0 +DA:278,0 +DA:280,0 +DA:281,0 +LF:132 +LH:0 +end_of_record +SF:lib/src/widgets/radio/ds_radio_tile.widget.dart +DA:14,0 +DA:22,0 +DA:46,0 +DA:48,0 +DA:49,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:59,0 +DA:60,0 +LF:13 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_video_message_bubble.widget.dart +DA:37,0 +DA:45,0 +DA:47,0 +DA:48,0 +DA:50,0 +DA:57,0 +DA:59,0 +DA:63,0 +DA:64,0 +DA:65,0 +DA:67,0 +DA:68,0 +DA:70,0 +DA:71,0 +DA:75,0 +DA:77,0 +DA:78,0 +DA:79,0 +DA:80,0 +DA:84,0 +DA:85,0 +DA:86,0 +DA:87,0 +DA:88,0 +DA:95,0 +DA:96,0 +DA:101,0 +DA:102,0 +LF:28 +LH:0 +end_of_record +SF:lib/src/widgets/chat/video/ds_video_player.widget.dart +DA:19,0 +DA:23,0 +DA:24,0 +DA:26,0 +DA:28,0 +DA:31,0 +DA:32,0 +DA:33,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:38,0 +DA:39,0 +DA:40,0 +DA:42,0 +DA:44,0 +DA:45,0 +DA:49,0 +DA:59,0 +DA:60,0 +DA:61,0 +DA:63,0 +DA:64,0 +DA:67,0 +DA:68,0 +DA:69,0 +DA:77,0 +DA:78,0 +DA:81,0 +DA:82,0 +DA:83,0 +LF:31 +LH:0 +end_of_record +SF:lib/src/themes/icons/ds_icons.dart +DA:27,0 +LF:1 +LH:0 +end_of_record +SF:lib/src/controllers/chat/ds_audio_message_bubble.controller.dart +DA:14,0 +DA:15,0 +DA:16,0 +DA:17,0 +DA:18,0 +DA:19,0 +DA:22,0 +DA:23,0 +DA:24,0 +DA:26,0 +DA:28,0 +DA:37,0 +LF:12 +LH:0 +end_of_record +SF:lib/src/controllers/chat/ds_file_message_bubble.controller.dart +DA:10,0 +DA:11,0 +DA:14,0 +DA:16,0 +DA:17,0 +DA:20,0 +DA:21,0 +DA:24,0 +DA:28,0 +DA:31,0 +LF:10 +LH:0 +end_of_record +SF:lib/src/services/ds_file.service.dart +DA:13,0 +DA:18,0 +DA:23,0 +DA:27,0 +DA:29,0 +DA:30,0 +DA:32,0 +DA:33,0 +DA:36,0 +DA:40,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:51,0 +DA:55,0 +DA:57,0 +DA:59,0 +DA:61,0 +DA:68,0 +DA:72,0 +LF:20 +LH:0 +end_of_record +SF:lib/src/controllers/chat/ds_image_message_bubble.controller.dart +DA:10,0 +DA:11,0 +DA:14,0 +DA:15,0 +DA:16,0 +DA:17,0 +DA:20,0 +DA:21,0 +DA:23,0 +DA:26,0 +DA:28,0 +DA:29,0 +DA:30,0 +DA:31,0 +DA:33,0 +DA:37,0 +LF:16 +LH:0 +end_of_record +SF:lib/src/controllers/chat/ds_url_preview.controller.dart +DA:10,0 +DA:11,0 +DA:13,0 +DA:14,0 +DA:16,0 +DA:18,0 +DA:21,0 +DA:23,0 +DA:28,0 +DA:29,0 +DA:30,0 +LF:11 +LH:0 +end_of_record +SF:lib/src/controllers/ds_video_player.controller.dart +DA:19,0 +DA:36,0 +DA:38,0 +DA:40,0 +DA:43,0 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:52,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:59,0 +DA:61,0 +DA:62,0 +DA:63,0 +DA:64,0 +DA:65,0 +DA:66,0 +DA:69,0 +DA:72,0 +DA:73,0 +DA:75,0 +DA:78,0 +DA:80,0 +DA:82,0 +DA:83,0 +DA:84,0 +DA:88,0 +DA:89,0 +DA:90,0 +DA:91,0 +DA:92,0 +DA:95,0 +DA:96,0 +DA:100,0 +DA:101,0 +DA:102,0 +DA:103,0 +DA:107,0 +DA:108,0 +DA:111,0 +DA:115,0 +DA:116,0 +DA:117,0 +DA:126,0 +DA:127,0 +DA:137,0 +DA:138,0 +LF:52 +LH:0 +end_of_record +SF:lib/src/models/ds_document_select.model.dart +DA:8,0 +DA:13,0 +DA:14,0 +DA:17,0 +DA:19,0 +DA:20,0 +DA:30,0 +DA:35,0 +DA:36,0 +DA:39,0 +DA:49,0 +DA:51,0 +DA:52,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:66,0 +LF:17 +LH:0 +end_of_record +SF:lib/src/models/ds_media_link.model.dart +DA:8,0 +DA:13,0 +DA:14,0 +DA:15,0 +DA:16,0 +DA:19,0 +DA:20,0 +DA:23,0 +DA:24,0 +DA:27,0 +DA:28,0 +LF:11 +LH:0 +end_of_record +SF:lib/src/models/ds_select_option.model.dart +DA:11,0 +DA:18,0 +DA:19,0 +DA:20,0 +DA:23,0 +DA:24,0 +DA:27,0 +DA:28,0 +DA:31,0 +DA:32,0 +LF:10 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_quick_reply.widget.dart +DA:16,0 +DA:21,0 +DA:23,0 +DA:25,0 +DA:27,0 +DA:31,0 +DA:32,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:39,0 +DA:41,0 +DA:42,0 +DA:43,0 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:50,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:56,0 +DA:58,0 +DA:59,0 +DA:60,0 +DA:64,0 +DA:67,0 +DA:71,0 +DA:73,0 +DA:78,0 +DA:80,0 +DA:81,0 +DA:86,0 +DA:87,0 +DA:98,0 +DA:100,0 +DA:103,0 +LF:39 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_select_menu.widget.dart +DA:16,0 +DA:22,0 +DA:23,0 +DA:25,0 +DA:27,0 +DA:29,0 +DA:30,0 +DA:35,0 +DA:36,0 +DA:40,0 +DA:41,0 +DA:42,0 +DA:44,0 +DA:45,0 +DA:47,0 +DA:48,0 +DA:50,0 +DA:51,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:56,0 +DA:57,0 +DA:58,0 +DA:60,0 +DA:62,0 +DA:63,0 +DA:64,0 +DA:67,0 +DA:70,0 +DA:72,0 +DA:75,0 +DA:76,0 +DA:77,0 +DA:92,0 +DA:93,0 +DA:94,0 +DA:107,0 +LF:38 +LH:0 +end_of_record +SF:lib/src/themes/icons/ds_icon_data.dart +DA:9,3 +DA:10,0 +LF:2 +LH:1 +end_of_record +SF:lib/src/themes/texts/styles/ds_text_style.theme.dart +DA:8,11 +DA:14,2 +LF:2 +LH:2 +end_of_record +SF:lib/src/widgets/buttons/ds_pause_button.widget.dart +DA:7,1 +DA:8,1 +DA:10,1 +DA:12,1 +DA:14,1 +DA:16,1 +DA:17,1 +DA:18,1 +DA:22,1 +DA:26,1 +DA:27,1 +DA:30,1 +DA:31,1 +LF:13 +LH:13 +end_of_record +SF:lib/src/widgets/buttons/ds_play_button.widget.dart +DA:8,1 +DA:9,1 +DA:11,1 +DA:13,1 +DA:15,2 +DA:16,1 +DA:20,1 +DA:25,1 +LF:8 +LH:8 +end_of_record +SF:lib/src/widgets/buttons/ds_play_button_rounded.widget.dart +DA:8,0 +DA:12,0 +DA:14,0 +DA:17,0 +DA:18,0 +DA:24,0 +DA:26,0 +DA:31,0 +DA:32,0 +DA:33,0 +LF:10 +LH:0 +end_of_record +SF:lib/src/widgets/chat/audio/ds_audio_seek_bar.widget.dart +DA:15,0 +DA:25,0 +DA:26,0 +DA:28,0 +DA:29,0 +DA:37,0 +DA:39,0 +DA:40,0 +DA:41,0 +DA:42,0 +DA:43,0 +DA:44,0 +DA:49,0 +DA:50,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:58,0 +DA:62,0 +DA:63,0 +DA:65,0 +DA:66,0 +DA:67,0 +DA:68,0 +DA:75,0 +DA:76,0 +DA:78,0 +DA:79,0 +DA:81,0 +DA:84,0 +DA:91,0 +DA:93,0 +DA:94,0 +DA:95,0 +DA:96,0 +DA:97,0 +DA:98,0 +DA:101,0 +DA:102,0 +DA:103,0 +DA:106,0 +DA:107,0 +DA:108,0 +DA:116,0 +DA:117,0 +DA:118,0 +DA:119,0 +DA:121,0 +DA:122,0 +DA:123,0 +DA:124,0 +DA:125,0 +DA:126,0 +DA:135,0 +DA:138,0 +LF:56 +LH:0 +end_of_record +SF:lib/src/widgets/chat/audio/ds_audio_speed_button.widget.dart +DA:10,0 +DA:16,0 +DA:18,0 +DA:20,0 +DA:22,0 +DA:24,0 +DA:25,0 +DA:26,0 +DA:29,0 +DA:31,0 +DA:33,0 +DA:34,0 +DA:35,0 +DA:36,0 +LF:14 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_document_select.widget.dart +DA:21,0 +DA:27,0 +DA:29,0 +DA:31,0 +DA:33,0 +DA:34,0 +DA:39,0 +DA:40,0 +DA:44,0 +DA:45,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:50,0 +DA:51,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:61,0 +DA:62,0 +DA:64,0 +DA:65,0 +DA:66,0 +DA:67,0 +DA:70,0 +DA:73,0 +DA:76,0 +DA:78,0 +DA:81,0 +DA:82,0 +DA:83,0 +DA:84,0 +DA:85,0 +DA:86,0 +DA:96,0 +DA:97,0 +DA:98,0 +DA:101,0 +DA:107,0 +LF:42 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_show_more_text.widget.dart +DA:12,0 +DA:18,0 +DA:22,0 +DA:24,0 +DA:25,0 +DA:27,0 +DA:28,0 +DA:29,0 +DA:36,0 +DA:37,0 +DA:38,0 +DA:41,0 +DA:45,0 +DA:47,0 +DA:49,0 +DA:50,0 +DA:60,0 +DA:61,0 +DA:63,0 +DA:64,0 +DA:66,0 +DA:67,0 +DA:68,0 +LF:23 +LH:0 +end_of_record +SF:lib/src/widgets/chat/ds_message_bubble_detail.widget.dart +DA:14,0 +DA:21,0 +DA:23,0 +DA:25,0 +DA:26,0 +DA:29,0 +DA:30,0 +DA:32,0 +DA:33,0 +DA:34,0 +DA:35,0 +DA:40,0 +DA:41,0 +DA:42,0 +LF:14 +LH:0 +end_of_record +SF:lib/src/widgets/chat/typing/ds_typing_dot.widget.dart +DA:10,0 +DA:14,0 +DA:16,0 +DA:18,0 +DA:19,0 +DA:21,0 +DA:23,0 +DA:24,0 +LF:8 +LH:0 +end_of_record +SF:lib/src/widgets/switch/ds_switch_base.widget.dart +DA:4,0 +DA:9,0 +LF:2 +LH:0 +end_of_record +SF:lib/src/widgets/texts/ds_text.widget.dart +DA:21,2 +DA:35,0 +DA:49,2 +DA:53,2 +DA:54,2 +DA:55,1 +DA:56,1 +DA:57,1 +DA:58,1 +DA:60,0 +DA:61,0 +DA:62,0 +DA:63,0 +DA:64,0 +DA:68,4 +DA:71,2 +DA:72,2 +DA:75,2 +DA:76,2 +DA:77,2 +DA:78,2 +DA:79,2 +LF:22 +LH:16 +end_of_record +SF:lib/src/widgets/utils/ds_card.widget.dart +DA:18,0 +DA:28,0 +DA:29,0 +DA:31,0 +DA:33,0 +DA:36,0 +DA:37,0 +DA:38,0 +DA:39,0 +DA:40,0 +DA:41,0 +DA:42,0 +DA:43,0 +DA:44,0 +DA:47,0 +DA:48,0 +DA:50,0 +DA:51,0 +DA:53,0 +DA:54,0 +DA:57,0 +DA:58,0 +DA:59,0 +DA:60,0 +DA:65,0 +DA:66,0 +DA:68,0 +DA:69,0 +DA:70,0 +DA:71,0 +DA:72,0 +DA:73,0 +DA:74,0 +DA:76,0 +DA:77,0 +DA:81,0 +DA:82,0 +DA:83,0 +DA:84,0 +DA:85,0 +DA:86,0 +DA:87,0 +DA:89,0 +DA:90,0 +DA:91,0 +DA:92,0 +DA:93,0 +DA:95,0 +DA:96,0 +DA:100,0 +DA:101,0 +DA:103,0 +DA:104,0 +DA:105,0 +DA:106,0 +DA:107,0 +DA:108,0 +DA:110,0 +DA:111,0 +DA:112,0 +DA:113,0 +DA:114,0 +DA:115,0 +DA:116,0 +DA:117,0 +DA:118,0 +DA:120,0 +DA:121,0 +DA:122,0 +DA:123,0 +DA:124,0 +DA:125,0 +DA:126,0 +DA:127,0 +DA:130,0 +DA:131,0 +DA:132,0 +DA:133,0 +DA:134,0 +DA:135,0 +DA:136,0 +LF:81 +LH:0 +end_of_record diff --git a/dart_test.yaml b/dart_test.yaml new file mode 100644 index 00000000..62bd2746 --- /dev/null +++ b/dart_test.yaml @@ -0,0 +1,2 @@ +tags: + golden: \ No newline at end of file diff --git a/lib/blip_ds.dart b/lib/blip_ds.dart index e8642f45..f576fc37 100644 --- a/lib/blip_ds.dart +++ b/lib/blip_ds.dart @@ -130,6 +130,12 @@ export 'src/widgets/chat/ds_video_message_bubble.widget.dart' export 'src/widgets/chat/video/ds_video_player.widget.dart' show DSVideoPlayer; export 'src/themes/icons/ds_icons.dart' show DSIcons; +/// Widgets / Carrousel +export 'src/widgets/chat/ds_carrousel.widget.dart' show DSCarrousel; + /// Widgets / Information message export 'src/widgets/ticket_message/ds_ticket_message.widget.dart' show DSTicketMessage; + +/// Icons +export 'src/themes/icons/ds_icons.dart' show DSIcons; \ No newline at end of file diff --git a/lib/src/controllers/chat/ds_file_message_bubble.controller.dart b/lib/src/controllers/chat/ds_file_message_bubble.controller.dart index f237d680..112c8771 100644 --- a/lib/src/controllers/chat/ds_file_message_bubble.controller.dart +++ b/lib/src/controllers/chat/ds_file_message_bubble.controller.dart @@ -1,9 +1,13 @@ import 'package:filesize/filesize.dart'; +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:path/path.dart' as path_utils; import 'package:blip_ds/src/services/ds_file.service.dart'; +import '../../themes/colors/ds_colors.theme.dart'; +import '../../themes/icons/ds_icons.dart'; + class DSFileMessageBubbleController extends GetxController { final isDownloading = RxBool(false); @@ -11,14 +15,55 @@ class DSFileMessageBubbleController extends GetxController { return filesize(size, 1); } - String getAsset(final String filename) { - const String path = 'assets/images'; + Icon getFileIcon(final String filename) { final String extension = path_utils.extension(filename).isNotEmpty ? path_utils.extension(filename).substring(1) : ''; - return path_utils.join(path, - 'file-${extension.length > 3 ? extension.substring(0, 3) : extension}.png'); + final type = extension.length > 3 ? extension.substring(0, 3) : extension; + + late final IconData icon; + late final Color color; + + switch (type) { + case 'csv': + icon = DSIcons.file_name_csv_outline; + color = DSColors.primaryGreensForest; + break; + case 'doc': + icon = DSIcons.file_name_doc_outline; + color = DSColors.primaryNight; + break; + case 'pdf': + icon = DSIcons.file_name_pdf_outline; + color = DSColors.extendRedsLipstick; + break; + case 'ppt': + icon = DSIcons.file_name_ppt_outline; + color = DSColors.primaryOrangesDoritos; + break; + case 'txt': + icon = DSIcons.file_name_txt_outline; + color = DSColors.neutralDarkRooftop; + break; + case 'xls': + icon = DSIcons.file_name_xls_outline; + color = DSColors.primaryGreensForest; + break; + case 'zip': + icon = DSIcons.file_name_zip_outline; + color = DSColors.extendBrownsWood; + break; + default: + icon = DSIcons.file_empty_file_outline; + color = DSColors.neutralDarkRooftop; + } + + return Icon( + icon, + size: 40, + color: color, + ); } Future openFile( diff --git a/lib/src/services/ds_bottom_sheet.service.dart b/lib/src/services/ds_bottom_sheet.service.dart index fb48c14e..ee5bfa23 100644 --- a/lib/src/services/ds_bottom_sheet.service.dart +++ b/lib/src/services/ds_bottom_sheet.service.dart @@ -1,6 +1,6 @@ import 'package:blip_ds/blip_ds.dart'; import 'package:flutter/material.dart'; -import 'package:get/state_manager.dart'; +import 'package:sticky_headers/sticky_headers.dart'; class DSBottomSheetService { final BuildContext context; @@ -15,78 +15,71 @@ class DSBottomSheetService { final window = WidgetsBinding.instance.window; final padding = MediaQueryData.fromWindow(window).padding.bottom + 36; - final RxBool showContainer = controller != null ? true.obs : false.obs; - return Container( margin: EdgeInsets.only( top: MediaQueryData.fromWindow(window).padding.top + 10, ), - decoration: const BoxDecoration( - color: DSColors.neutralLightSnow, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, - ), - child: Stack( - children: [ - IgnorePointer( - child: SizedBox( - height: 30.0, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, + decoration: _border(), + child: Stack( + children: [ + controller != null + ? ListView( + controller: controller, children: [ - Container( - height: 4.0, - width: 32.0, - decoration: const BoxDecoration( - color: DSColors.neutralMediumWave, - borderRadius: BorderRadius.all( - Radius.circular(15.0), - ), + StickyHeader( + overlapHeaders: false, + header: _grabber(), + content: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: _buildChild(padding), ), ), ], + ) + : Column( + mainAxisSize: MainAxisSize.min, + children: [ + _grabber(), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: _buildChild(padding), + ), + ], ), - ), - ), - Obx( - () => Padding( - padding: EdgeInsets.only(top: showContainer.value ? 0 : 35.0), - child: controller != null - ? NotificationListener( - child: ListView( - controller: controller, - children: [ - Visibility( - visible: showContainer.value, - child: Container( - padding: const EdgeInsets.only(top: 20.0), - color: Colors.transparent, - height: 35.0, - ), - ), - _buildChild(padding) - ], - ), - onNotification: (t) { - if (controller.position.pixels > 0) { - showContainer.value = false; - } + ], + ), + ); + } - return true; - }, - ) - : _buildChild(padding), + BoxDecoration _border() { + return const BoxDecoration( + color: DSColors.neutralLightSnow, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), + ), + ); + } + + Widget _grabber() { + return Container( + height: 30.0, + decoration: _border(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 4.0, + width: 32.0, + decoration: const BoxDecoration( + color: DSColors.neutralMediumWave, + borderRadius: BorderRadius.all( + Radius.circular(15.0), ), ), - ], - ), + ), + ], ), ); } @@ -100,11 +93,11 @@ class DSBottomSheetService { ); } - void showDraggable({ + Future showDraggable({ final double minSize = 0.25, final double initSize = 0.5, }) { - showModalBottomSheet( + return showModalBottomSheet( backgroundColor: Colors.transparent, isScrollControlled: true, context: context, @@ -120,8 +113,8 @@ class DSBottomSheetService { ); } - void show() { - showModalBottomSheet( + Future show() { + return showModalBottomSheet( backgroundColor: Colors.transparent, context: context, builder: (_) => _buildBottomSheet(), diff --git a/lib/src/services/ds_dialog.service.dart b/lib/src/services/ds_dialog.service.dart index df4a2ea4..82c947fb 100644 --- a/lib/src/services/ds_dialog.service.dart +++ b/lib/src/services/ds_dialog.service.dart @@ -1,10 +1,9 @@ import 'package:blip_ds/src/enums/ds_dialog_type.enum.dart'; import 'package:blip_ds/src/widgets/buttons/ds_button.widget.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import '../themes/colors/ds_colors.theme.dart'; -import '../utils/ds_utils.util.dart'; +import '../themes/icons/ds_icons.dart'; import '../widgets/texts/ds_body_text.widget.dart'; import '../widgets/texts/ds_headline_small_text.widget.dart'; @@ -25,14 +24,12 @@ class DSDialogService { this.secondButton, }); - void _show(final DSDialogType type) { - showDialog( - context: context, - barrierDismissible: false, - useSafeArea: true, - builder: (context) => _buildDialog(type), - ); - } + Future _show(final DSDialogType type) => showDialog( + context: context, + barrierDismissible: false, + useSafeArea: true, + builder: (context) => _buildDialog(type), + ); Widget _buildDialog(final DSDialogType type) { Widget buildHeader() { @@ -42,7 +39,18 @@ class DSDialogService { ? DSColors.primaryYellowsCorn : DSColors.extendRedsFlower; - final String icon = 'assets/images/icon_alert_${describeEnum(type)}.png'; + late final IconData icon; + + switch (type) { + case DSDialogType.error: + icon = DSIcons.error_outline; + break; + case DSDialogType.warning: + icon = DSIcons.warning_outline; + break; + default: + icon = DSIcons.info_outline; + } return Container( height: 64.0, @@ -60,10 +68,10 @@ class DSDialogService { ), child: Row( children: [ - Image.asset( + Icon( icon, - package: DSUtils.packageName, - width: 28.0, + size: 32, + color: DSColors.neutralDarkCity, ), Padding( padding: const EdgeInsets.only(left: 8.0), @@ -141,17 +149,11 @@ class DSDialogService { } /// Shows a [DSDialogType.warning] dialog box type - void warning() { - _show(DSDialogType.warning); - } + Future warning() => _show(DSDialogType.warning); /// Shows a [DSDialogType.system] dialog box type - void system() { - _show(DSDialogType.system); - } + Future system() => _show(DSDialogType.system); /// Shows a [DSDialogType.error] dialog box type - void error() { - _show(DSDialogType.error); - } + Future error() => _show(DSDialogType.error); } diff --git a/lib/src/services/ds_toast.service.dart b/lib/src/services/ds_toast.service.dart index 3e8f74a5..d1b65f1e 100644 --- a/lib/src/services/ds_toast.service.dart +++ b/lib/src/services/ds_toast.service.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; - import 'package:flutter_svg/svg.dart'; + import 'package:simple_animations/simple_animations.dart'; import 'package:blip_ds/blip_ds.dart'; @@ -135,41 +135,49 @@ class DSToastService { return Material( elevation: 10.0, borderRadius: BorderRadius.circular(8.0), - child: Container( - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: BorderRadius.circular(8.0), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (icon != null) - Container( - alignment: Alignment.topLeft, - child: icon, - ), - Flexible( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (title != null) DSHeadlineSmallText(title), - DSBodyText( - message, - overflow: TextOverflow.visible, + clipBehavior: Clip.hardEdge, + child: Stack( + children: [ + Positioned( + left: -15, + top: -2, + child: SvgPicture.asset( + 'assets/images/blip_ balloon.svg', + package: DSUtils.packageName, + ), + ), + Container( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.circular(8.0), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (icon != null) icon!, + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 8, horizontal: 16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (title != null) DSHeadlineSmallText(title), + DSBodyText( + message, + overflow: TextOverflow.visible, + ), + ], ), - ], + ), ), - ), - ), - Container( - alignment: Alignment.topLeft, - child: _setMainButton(), + _setMainButton(), + ], ), - ], - ), + ), + ], ), ); } @@ -177,81 +185,52 @@ class DSToastService { /// Prepares the presentation of toast elements according to the type void _prepareToast(final DSToastType type) { switch (type) { - case DSToastType.success: - backgroundColor = DSColors.primaryGreensMint; - icon = Padding( - padding: const EdgeInsets.only(top: 20.0, left: 20.0), - child: _setIcon('assets/images/icon_like.svg'), - ); - break; case DSToastType.warning: backgroundColor = DSColors.primaryYellowsCorn; - icon = Padding( - padding: const EdgeInsets.only(top: 20.0, left: 20.0), - child: _setIcon('assets/images/icon_warning.svg'), - ); + icon = _setIcon(DSIcons.warning_outline); break; case DSToastType.error: backgroundColor = DSColors.extendRedsFlower; - icon = Padding( - padding: const EdgeInsets.only(top: 20.0, left: 20.0), - child: _setIcon('assets/images/icon_error.svg'), - ); + icon = _setIcon(DSIcons.error_outline); break; case DSToastType.system: backgroundColor = DSColors.illustrationBlueGenie; - icon = Padding( - padding: const EdgeInsets.only(top: 20.0, left: 20.0), - child: _setIcon('assets/images/icon_message.svg'), - ); + icon = _setIcon(DSIcons.message_ballon_outline); break; case DSToastType.notification: - backgroundColor = DSColors.neutralLightSnow; - icon = SizedBox( - width: 50.0, - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: Image.asset( - 'assets/images/notificacao.png', - package: DSUtils.packageName, - ), - ), - ); + backgroundColor = Colors.transparent; + icon = _setIcon(DSIcons.bell_outline); break; default: - DSToastType.success; + backgroundColor = DSColors.primaryGreensMint; + icon = _setIcon(DSIcons.like_outline); } } /// Switches between exit button types Widget _setMainButton() { return actionType == DSToastActionType.icon - ? Container( - padding: const EdgeInsets.only(top: 10.0, right: 10.0), - child: IconButton( - onPressed: () { - state!(() { + ? DSIconButton( + size: 40.0, + icon: const Icon(DSIcons.close_outline), + onPressed: () { + state!(() { + _stopTimer(); + _controlAnimation = Control.playReverse; + }); + }, + ) + : DSTertiaryButton( + label: buttonText, + onPressed: () { + onPressedButton!(); + state!( + () { _stopTimer(); _controlAnimation = Control.playReverse; - }); - }, - icon: const Icon(Icons.close), - ), - ) - : Container( - padding: const EdgeInsets.only(top: 10.0, right: 10.0), - child: DSTertiaryButton( - onPressed: () { - onPressedButton!(); - state!( - () { - _stopTimer(); - _controlAnimation = Control.playReverse; - }, - ); - }, - label: buttonText, - ), + }, + ); + }, ); } @@ -301,12 +280,13 @@ class DSToastService { ); } - Widget _setIcon(final String image) { - return SvgPicture.asset( - image, - package: DSUtils.packageName, - height: 24.0, - width: 24.0, + Widget _setIcon(final IconData icon) { + return Padding( + padding: const EdgeInsets.only(top: 8), + child: Icon( + icon, + color: DSColors.neutralDarkCity, + ), ); } diff --git a/lib/src/themes/colors/ds_colors.theme.dart b/lib/src/themes/colors/ds_colors.theme.dart index e6d3e591..6d7f3c4c 100644 --- a/lib/src/themes/colors/ds_colors.theme.dart +++ b/lib/src/themes/colors/ds_colors.theme.dart @@ -2,11 +2,14 @@ import 'package:flutter/material.dart'; /// All [Color] constants that are used by this Design System. abstract class DSColors { + static const Color primaryLight = Color(0xFFB3D4FF); static const Color primaryMain = Color(0xFF3F7DE8); static const Color primaryNight = Color(0xFF0747A6); - static const Color primaryLight = Color(0xFFB3D4FF); + static const Color primaryGreensMint = Color(0xFF90E6BC); static const Color primaryGreensTrue = Color(0xFF21CC79); + static const Color primaryGreensForest = Color(0xFF0A6045); static const Color primaryYellowsCorn = Color(0xFFFFF6A8); + static const Color primaryOrangesDoritos = Color(0xFFC64026); static const Color neutralDarkCity = Color(0xFF202C44); static const Color neutralDarkDesk = Color(0xFF3A4A65); @@ -17,13 +20,15 @@ abstract class DSColors { static const Color neutralMediumSilver = Color(0xFFB9CBD3); static const Color neutralMediumWave = Color(0xFFD2DFE6); static const Color neutralLightBox = Color(0xFFE7EDF4); + static const Color neutralLightWhisper = Color(0xFFF3F6FA); static const Color neutralLightSnow = Color(0xFFFFFFFF); static const Color illustrationBlueGenie = Color(0xFF80E3EB); - static const Color primaryGreensMint = Color(0xFF90E6BC); - static const Color extendRedsLipstick = Color(0xFFA01C2C); + static const Color extendRedsFlower = Color(0xFFFFA5A5); + static const Color extendRedsLipstick = Color(0xFFA01C2C); static const Color extendRedsDragon = Color(0xFF6A2026); + static const Color extendBrownsWood = Color(0xFF845D37); static const Color disabledText = Color(0xFF637798); static const Color disabledBg = Color(0xFFE8F2FF); diff --git a/lib/src/themes/icons/ds_icons.dart b/lib/src/themes/icons/ds_icons.dart index 4d22095c..0c9aa259 100644 --- a/lib/src/themes/icons/ds_icons.dart +++ b/lib/src/themes/icons/ds_icons.dart @@ -26,232 +26,237 @@ import 'ds_icon_data.dart'; class DSIcons { DSIcons._(); - static const IconData builder_quick_reply = DSIconData(0xe800); - static const IconData text_style_italic = DSIconData(0xe801); - static const IconData chart_line = DSIconData(0xe802); - static const IconData arrow_down = DSIconData(0xe803); - static const IconData arrow_ball_up = DSIconData(0xe804); - static const IconData file_name_zip = DSIconData(0xe805); - static const IconData file_name_doc = DSIconData(0xe806); - static const IconData file_doc = DSIconData(0xe807); - static const IconData file_java_script = DSIconData(0xe808); - static const IconData file_gif = DSIconData(0xe809); - static const IconData builder_router = DSIconData(0xe80a); - static const IconData settings_adjusments = DSIconData(0xe80b); - static const IconData arrow_ball_down = DSIconData(0xe80c); - static const IconData file_empty_file = DSIconData(0xe80d); - static const IconData file_txt = DSIconData(0xe80e); - static const IconData message_received = DSIconData(0xe80f); - static const IconData text_style_underline = DSIconData(0xe810); - static const IconData file_name_txt = DSIconData(0xe811); - static const IconData message_talk = DSIconData(0xe812); - static const IconData arrow_first = DSIconData(0xe813); - static const IconData arrow_right = DSIconData(0xe814); - static const IconData builder_new_state = DSIconData(0xe815); - static const IconData chart_pizza = DSIconData(0xe816); - static const IconData text_style_bold = DSIconData(0xe817); - static const IconData file_image = DSIconData(0xe818); - static const IconData more_options_vertical = DSIconData(0xe819); - static const IconData menu_hamburger = DSIconData(0xe81a); - static const IconData file_image_expired = DSIconData(0xe81b); - static const IconData settings_builder = DSIconData(0xe81c); - static const IconData builder_text_message = DSIconData(0xe81d); - static const IconData file_new = DSIconData(0xe81e); - static const IconData more_options_horizontal = DSIconData(0xe81f); - static const IconData arrow_filter_table = DSIconData(0xe820); - static const IconData arrow_ball_right = DSIconData(0xe821); - static const IconData file_video_expired = DSIconData(0xe822); - static const IconData file_image_broken = DSIconData(0xe823); - static const IconData file_name_xls = DSIconData(0xe824); - static const IconData message_active = DSIconData(0xe825); - static const IconData chart_bar = DSIconData(0xe826); - static const IconData chart_column = DSIconData(0xe827); - static const IconData message_sent = DSIconData(0xe828); - static const IconData file_txt_1 = DSIconData(0xe829); - static const IconData message_total = DSIconData(0xe82a); - static const IconData message_ballon = DSIconData(0xe82b); - static const IconData arrow_up = DSIconData(0xe82c); - static const IconData builder_menu = DSIconData(0xe82d); - static const IconData arrow_left = DSIconData(0xe82e); - static const IconData file_name_csv = DSIconData(0xe82f); - static const IconData menu_dot = DSIconData(0xe830); - static const IconData file_csv = DSIconData(0xe831); - static const IconData builder_test_bot = DSIconData(0xe832); - static const IconData arrow_ball_left = DSIconData(0xe833); - static const IconData builder_carrousel = DSIconData(0xe834); - static const IconData arrow_last = DSIconData(0xe835); - static const IconData file_name_ppt = DSIconData(0xe836); - static const IconData builder_publish_bot = DSIconData(0xe837); - static const IconData text_style_strikethrough = DSIconData(0xe838); - static const IconData file_name_pdf = DSIconData(0xe839); - static const IconData file_ppt = DSIconData(0xe83a); - static const IconData file_pdf = DSIconData(0xe83b); - static const IconData file_json = DSIconData(0xe83c); - static const IconData localization = DSIconData(0xe83d); - static const IconData link = DSIconData(0xe83e); - static const IconData library_icon = DSIconData(0xe83f); - static const IconData settings_general = DSIconData(0xe840); - static const IconData channels = DSIconData(0xe841); - static const IconData ab = DSIconData(0xe842); - static const IconData debug = DSIconData(0xe843); - static const IconData status = DSIconData(0xe844); - static const IconData blip_tutorials = DSIconData(0xe845); - static const IconData blip_ideas = DSIconData(0xe846); - static const IconData share = DSIconData(0xe847); - static const IconData payment_card = DSIconData(0xe848); - static const IconData bill = DSIconData(0xe849); - static const IconData barcode = DSIconData(0xe84a); - static const IconData payment_card_cvc = DSIconData(0xe84b); - static const IconData pix = DSIconData(0xe84c); - static const IconData qrcode = DSIconData(0xe84d); - static const IconData chip = DSIconData(0xe84e); - static const IconData smartphone = DSIconData(0xe84f); - static const IconData target = DSIconData(0xe850); - static const IconData megaphone = DSIconData(0xe851); - static const IconData folder = DSIconData(0xe852); - static const IconData robot = DSIconData(0xe853); - static const IconData ai = DSIconData(0xe854); - static const IconData upload = DSIconData(0xe855); - static const IconData save_disk = DSIconData(0xe856); - static const IconData edit = DSIconData(0xe857); - static const IconData trash = DSIconData(0xe858); - static const IconData favorite = DSIconData(0xe859); - static const IconData download = DSIconData(0xe85a); - static const IconData order_elements = DSIconData(0xe85b); - static const IconData deslike = DSIconData(0xe85c); - static const IconData move = DSIconData(0xe85d); - static const IconData save_flag = DSIconData(0xe85e); - static const IconData like = DSIconData(0xe85f); - static const IconData notes = DSIconData(0xe860); - static const IconData search = DSIconData(0xe861); - static const IconData audio = DSIconData(0xe862); - static const IconData speaker = DSIconData(0xe863); - static const IconData notebook = DSIconData(0xe864); - static const IconData paperplane = DSIconData(0xe865); - static const IconData mouse = DSIconData(0xe866); - static const IconData airplane = DSIconData(0xe867); - static const IconData add_persistent_menu = DSIconData(0xe868); - static const IconData messenger = DSIconData(0xe869); - static const IconData cloud = DSIconData(0xe86a); - static const IconData filter = DSIconData(0xe86b); - static const IconData attach = DSIconData(0xe86d); - static const IconData resources = DSIconData(0xe86e); - static const IconData delete = DSIconData(0xe86f); - static const IconData integration = DSIconData(0xe870); - static const IconData external_file = DSIconData(0xe871); - static const IconData skills = DSIconData(0xe872); - static const IconData camera = DSIconData(0xe873); - static const IconData service_queue = DSIconData(0xe874); - static const IconData bug_report = DSIconData(0xe875); - static const IconData loading = DSIconData(0xe876); - static const IconData primeiro_acesso = DSIconData(0xe877); - static const IconData custom_channel = DSIconData(0xe878); - static const IconData button = DSIconData(0xe879); - static const IconData site = DSIconData(0xe87a); - static const IconData copy = DSIconData(0xe87b); - static const IconData close = DSIconData(0xe87c); - static const IconData add = DSIconData(0xe87d); - static const IconData true_icon = DSIconData(0xe87e); - static const IconData plus = DSIconData(0xe87f); - static const IconData trophy = DSIconData(0xe880); - static const IconData conections = DSIconData(0xe881); - static const IconData integrations_channels = DSIconData(0xe882); - static const IconData book = DSIconData(0xe883); - static const IconData air_balloon = DSIconData(0xe884); - static const IconData emoji = DSIconData(0xe885); - static const IconData mail = DSIconData(0xe886); - static const IconData cloud_2 = DSIconData(0xe887); - static const IconData keyboard = DSIconData(0xe888); - static const IconData guide = DSIconData(0xe889); - static const IconData paint = DSIconData(0xe88a); - static const IconData plugin = DSIconData(0xe88b); - static const IconData tag = DSIconData(0xe88c); - static const IconData cookie = DSIconData(0xe88d); - static const IconData ticket = DSIconData(0xe88e); - static const IconData logout = DSIconData(0xe88f); - static const IconData home = DSIconData(0xe890); - static const IconData monitoring = DSIconData(0xe891); - static const IconData screen_fill = DSIconData(0xe892); - static const IconData screen_full = DSIconData(0xe893); - static const IconData sso = DSIconData(0xe894); - static const IconData user_engaged = DSIconData(0xe895); - static const IconData team = DSIconData(0xe896); - static const IconData agent = DSIconData(0xe897); - static const IconData user_active = DSIconData(0xe898); - static const IconData avatar_user = DSIconData(0xe899); - static const IconData user_defaut = DSIconData(0xe89a); - static const IconData contact = DSIconData(0xe89b); - static const IconData checkball = DSIconData(0xe89c); - static const IconData error = DSIconData(0xe89d); - static const IconData voip = DSIconData(0xe89e); - static const IconData faq = DSIconData(0xe89f); - static const IconData false_icon = DSIconData(0xe8a0); - static const IconData send = DSIconData(0xe8a1); - static const IconData info = DSIconData(0xe8a2); - static const IconData email = DSIconData(0xe8a3); - static const IconData warning = DSIconData(0xe8a4); - static const IconData bell = DSIconData(0xe8a5); - static const IconData sms = DSIconData(0xe8a6); - static const IconData attention = DSIconData(0xe8a7); - static const IconData question = DSIconData(0xe8a8); - static const IconData list = DSIconData(0xe8a9); - static const IconData undo = DSIconData(0xe8aa); - static const IconData restore = DSIconData(0xe8ab); - static const IconData redo = DSIconData(0xe8ac); - static const IconData refresh = DSIconData(0xe8ad); - static const IconData priorization = DSIconData(0xe8ae); - static const IconData transfer = DSIconData(0xe8af); - static const IconData unlock = DSIconData(0xe8b0); - static const IconData lock = DSIconData(0xe8b1); - static const IconData eye_closed = DSIconData(0xe8b2); - static const IconData data_security = DSIconData(0xe8b3); - static const IconData eye_open = DSIconData(0xe8b4); - static const IconData video = DSIconData(0xe8b5); - static const IconData video_broken = DSIconData(0xe8b6); - static const IconData xml = DSIconData(0xe8b7); - static const IconData company = DSIconData(0xe8b8); - static const IconData business = DSIconData(0xe8b9); - static const IconData calendar = DSIconData(0xe8ba); - static const IconData clock = DSIconData(0xe8bb); - static const IconData date_time = DSIconData(0xe8bc); - static const IconData redirect_solid = DSIconData(0xe8bd); - static const IconData java_script_solid = DSIconData(0xe8be); - static const IconData agent_rule_solid = DSIconData(0xe8bf); - static const IconData variable_solid = DSIconData(0xe8c0); - static const IconData http_solid = DSIconData(0xe8c1); - static const IconData tracking_solid = DSIconData(0xe8c2); - static const IconData level_up_solid = DSIconData(0xe8c3); - static const IconData blip_forum_solid = DSIconData(0xe8c4); - static const IconData bill_solid = DSIconData(0xe8c5); - static const IconData barcode_solid = DSIconData(0xe8c6); - static const IconData pix_solid = DSIconData(0xe8c7); - static const IconData qrcode_solid = DSIconData(0xe8c8); - static const IconData folder_solid = DSIconData(0xe8c9); - static const IconData folder_save_solid = DSIconData(0xe8ca); - static const IconData favorite_solid = DSIconData(0xe8cb); - static const IconData save_solid = DSIconData(0xe8cc); - static const IconData audio_solid = DSIconData(0xe8cd); - static const IconData add_solid = DSIconData(0xe8ce); - static const IconData checkball_solid = DSIconData(0xe8cf); - static const IconData error_solid = DSIconData(0xe8d0); - static const IconData voip_solid = DSIconData(0xe8d1); - static const IconData send_solid = DSIconData(0xe8d2); - static const IconData info_solid = DSIconData(0xe8d3); - static const IconData email_solid = DSIconData(0xe8d4); - static const IconData warning_solid = DSIconData(0xe8d5); - static const IconData sms_solid = DSIconData(0xe8d6); - static const IconData attention_solid = DSIconData(0xe8d7); - static const IconData question_solid = DSIconData(0xe8d8); - static const IconData left_ball_solid = DSIconData(0xe8d9); - static const IconData right_ball_solid = DSIconData(0xe8da); - static const IconData up_ball_solid = DSIconData(0xe8db); - static const IconData down_ball_solid = DSIconData(0xe8dc); - static const IconData blocks_solid = DSIconData(0xe8dd); - static const IconData list_solid = DSIconData(0xe8de); - static const IconData left_solid = DSIconData(0xe8df); - static const IconData right_solid = DSIconData(0xe8e0); - static const IconData filter_table_solid = DSIconData(0xe8e1); - static const IconData up_solid = DSIconData(0xe8e2); - static const IconData down_solid = DSIconData(0xe8e3); - static const IconData video_solid = DSIconData(0xe8e4); + static const IconData add_solid = DSIconData(0xe9d8); + static const IconData agent_rule_solid = DSIconData(0xe9d9); + static const IconData arrow_down_ball_solid = DSIconData(0xe9e1); + static const IconData arrow_down_solid = DSIconData(0xe9e2); + static const IconData arrow_left_ball_solid = DSIconData(0xe9ec); + static const IconData arrow_left_solid = DSIconData(0xe9ed); + static const IconData arrow_right_ball_solid = DSIconData(0xe9f3); + static const IconData arrow_right_solid = DSIconData(0xe9f4); + static const IconData arrow_up_ball_solid = DSIconData(0xe9f9); + static const IconData arrow_up_solid = DSIconData(0xe9fa); + static const IconData attention_solid = DSIconData(0xe9da); + static const IconData audio_solid = DSIconData(0xe9db); + static const IconData barcode_solid = DSIconData(0xe9dc); + static const IconData bill_solid = DSIconData(0xe9dd); + static const IconData blip_forum_solid = DSIconData(0xe9de); + static const IconData blocks_solid = DSIconData(0xe9df); + static const IconData checkball_solid = DSIconData(0xe9e0); + static const IconData email_solid = DSIconData(0xe9e3); + static const IconData error_solid = DSIconData(0xe9e4); + static const IconData favorite_solid = DSIconData(0xe9e5); + static const IconData filter_table_solid = DSIconData(0xe9e6); + static const IconData folder_save_solid = DSIconData(0xe9e8); + static const IconData folder_solid = DSIconData(0xe9e7); + static const IconData http_solid = DSIconData(0xe9e9); + static const IconData info_solid = DSIconData(0xe9ea); + static const IconData java_script_solid = DSIconData(0xe9eb); + static const IconData level_up_solid = DSIconData(0xe9d7); + static const IconData list_solid = DSIconData(0xe9ee); + static const IconData pix_solid = DSIconData(0xe9ef); + static const IconData qrcode_solid = DSIconData(0xe9f0); + static const IconData question_solid = DSIconData(0xe9f1); + static const IconData redirect_solid = DSIconData(0xe9f2); + static const IconData save_solid = DSIconData(0xe9f5); + static const IconData send_solid = DSIconData(0xe9f6); + static const IconData sms_solid = DSIconData(0xe9f7); + static const IconData tracking_solid = DSIconData(0xe9f8); + static const IconData variable_solid = DSIconData(0xe9fb); + static const IconData video_solid = DSIconData(0xe9fc); + static const IconData voip_solid = DSIconData(0xe9fd); + static const IconData warning_solid = DSIconData(0xe9fe); + static const IconData site_outline = DSIconData(0xe900); + static const IconData ab_outline = DSIconData(0xe901); + static const IconData add_outline = DSIconData(0xe902); + static const IconData add_persistent_menu_outline = DSIconData(0xe903); + static const IconData agent_outline = DSIconData(0xe904); + static const IconData ai_outline = DSIconData(0xe905); + static const IconData air_balloon_outline = DSIconData(0xe906); + static const IconData airplane_outline = DSIconData(0xe907); + static const IconData arrow_ball_down_outline = DSIconData(0xe908); + static const IconData arrow_ball_left_outline = DSIconData(0xe909); + static const IconData arrow_ball_right_outline = DSIconData(0xe90a); + static const IconData arrow_ball_up_outline = DSIconData(0xe90b); + static const IconData arrow_down_outline = DSIconData(0xe90c); + static const IconData arrow_filter_table_outline = DSIconData(0xe90d); + static const IconData arrow_first_outline = DSIconData(0xe90e); + static const IconData arrow_last_outline = DSIconData(0xe90f); + static const IconData arrow_left_outline = DSIconData(0xe910); + static const IconData arrow_right_outline = DSIconData(0xe911); + static const IconData arrow_up_outline = DSIconData(0xe912); + static const IconData attach_outline = DSIconData(0xe913); + static const IconData attention_outline = DSIconData(0xe914); + static const IconData audio_outline = DSIconData(0xe915); + static const IconData avatar_user_outline = DSIconData(0xe916); + static const IconData barcode_outline = DSIconData(0xe917); + static const IconData bell_outline = DSIconData(0xe918); + static const IconData bill_outline = DSIconData(0xe919); + static const IconData blip_ideas_outline = DSIconData(0xe91a); + static const IconData blip_tutorials_outline = DSIconData(0xe91b); + static const IconData book_outline = DSIconData(0xe91c); + static const IconData bug_report_outline = DSIconData(0xe91e); + static const IconData builder_carrousel_outline = DSIconData(0xe91f); + static const IconData builder_menu_outline = DSIconData(0xe920); + static const IconData builder_new_state_outline = DSIconData(0xe921); + static const IconData builder_publish_bot_outline = DSIconData(0xe922); + static const IconData builder_quick_reply_outline = DSIconData(0xe923); + static const IconData builder_router_outline = DSIconData(0xe925); + static const IconData builder_test_bot_outline = DSIconData(0xe926); + static const IconData builder_text_message_outline = DSIconData(0xe928); + static const IconData business_outline = DSIconData(0xe929); + static const IconData button_outline = DSIconData(0xe92a); + static const IconData calendar_outline = DSIconData(0xe92b); + static const IconData camera_outline = DSIconData(0xe92c); + static const IconData channels_outline = DSIconData(0xe92d); + static const IconData chart_bar_outline = DSIconData(0xe92e); + static const IconData chart_column_outline = DSIconData(0xe930); + static const IconData chart_line_outline = DSIconData(0xe932); + static const IconData chart_pizza_outline = DSIconData(0xe935); + static const IconData check_outline = DSIconData(0xe937); + static const IconData checkball_outline = DSIconData(0xe938); + static const IconData chip_outline = DSIconData(0xe939); + static const IconData clock_outline = DSIconData(0xe941); + static const IconData close_outline = DSIconData(0xe942); + static const IconData cloud_outline = DSIconData(0xe943); + static const IconData cloud_2_outline = DSIconData(0xe944); + static const IconData company_outline = DSIconData(0xe945); + static const IconData conections_outline = DSIconData(0xe946); + static const IconData contact_outline = DSIconData(0xe947); + static const IconData cookie_outline = DSIconData(0xe948); + static const IconData copy_outline = DSIconData(0xe949); + static const IconData custom_channel_outline = DSIconData(0xe94a); + static const IconData data_security_outline = DSIconData(0xe94b); + static const IconData date_time_outline = DSIconData(0xe94c); + static const IconData debug_outline = DSIconData(0xe94d); + static const IconData delete_outline = DSIconData(0xe94e); + static const IconData deslike_outline = DSIconData(0xe94f); + static const IconData double_check_outline = DSIconData(0xe950); + static const IconData download_outline = DSIconData(0xe951); + static const IconData edit_outline = DSIconData(0xe952); + static const IconData email_outline = DSIconData(0xe953); + static const IconData emoji_outline = DSIconData(0xe954); + static const IconData error_outline = DSIconData(0xe955); + static const IconData external_file_outline = DSIconData(0xe956); + static const IconData eye_closed_outline = DSIconData(0xe957); + static const IconData eye_open_outline = DSIconData(0xe958); + static const IconData false_outline = DSIconData(0xe959); + static const IconData faq_outline = DSIconData(0xe95a); + static const IconData favorite_outline = DSIconData(0xe95b); + static const IconData file_csv_outline = DSIconData(0xe95c); + static const IconData file_doc_outline = DSIconData(0xe95d); + static const IconData file_empty_file_outline = DSIconData(0xe95e); + static const IconData file_gif_outline = DSIconData(0xe95f); + static const IconData file_image_outline = DSIconData(0xe960); + static const IconData file_image_broken_outline = DSIconData(0xe961); + static const IconData file_image_expired_outline = DSIconData(0xe962); + static const IconData file_java_script_outline = DSIconData(0xe963); + static const IconData file_json_outline = DSIconData(0xe964); + static const IconData file_name_csv_outline = DSIconData(0xe965); + static const IconData file_name_doc_outline = DSIconData(0xe966); + static const IconData file_name_pdf_outline = DSIconData(0xe967); + static const IconData file_name_ppt_outline = DSIconData(0xe968); + static const IconData file_name_txt_outline = DSIconData(0xe969); + static const IconData file_name_xls_outline = DSIconData(0xe96a); + static const IconData file_name_zip_outline = DSIconData(0xe96b); + static const IconData file_new_outline = DSIconData(0xe96c); + static const IconData file_pdf_outline = DSIconData(0xe96d); + static const IconData file_ppt_outline = DSIconData(0xe96e); + static const IconData file_txt_outline = DSIconData(0xe96f); + static const IconData file_txt_1_outline = DSIconData(0xe970); + static const IconData file_video_expired_outline = DSIconData(0xe971); + static const IconData filter_outline = DSIconData(0xe972); + static const IconData folder_outline = DSIconData(0xe973); + static const IconData guide_outline = DSIconData(0xe974); + static const IconData home_outline = DSIconData(0xe977); + static const IconData info_outline = DSIconData(0xe978); + static const IconData integration_outline = DSIconData(0xe979); + static const IconData integrations_channels_outline = DSIconData(0xe97a); + static const IconData keyboard_outline = DSIconData(0xe97b); + static const IconData less_outline = DSIconData(0xe97c); + static const IconData library_outline = DSIconData(0xe97d); + static const IconData like_outline = DSIconData(0xe97f); + static const IconData link_outline = DSIconData(0xe980); + static const IconData list_outline = DSIconData(0xe981); + static const IconData loading_outline = DSIconData(0xe982); + static const IconData localization_outline = DSIconData(0xe983); + static const IconData lock_outline = DSIconData(0xe984); + static const IconData logout_outline = DSIconData(0xe985); + static const IconData mail_outline = DSIconData(0xe986); + static const IconData megaphone_outline = DSIconData(0xe987); + static const IconData menu_dot_outline = DSIconData(0xe988); + static const IconData menu_hamburger_outline = DSIconData(0xe989); + static const IconData message_active_outline = DSIconData(0xe98a); + static const IconData message_ballon_outline = DSIconData(0xe98b); + static const IconData message_received_outline = DSIconData(0xe98c); + static const IconData message_sent_outline = DSIconData(0xe98d); + static const IconData message_talk_outline = DSIconData(0xe98e); + static const IconData message_total_outline = DSIconData(0xe98f); + static const IconData messenger_outline = DSIconData(0xe991); + static const IconData monitoring_outline = DSIconData(0xe992); + static const IconData more_options_horizontal_outline = DSIconData(0xe994); + static const IconData more_options_vertical_outline = DSIconData(0xe995); + static const IconData mouse_outline = DSIconData(0xe996); + static const IconData move_outline = DSIconData(0xe997); + static const IconData notebook_outline = DSIconData(0xe998); + static const IconData notes_outline = DSIconData(0xe999); + static const IconData order_elements_outline = DSIconData(0xe99a); + static const IconData paint_outline = DSIconData(0xe99b); + static const IconData paperplane_outline = DSIconData(0xe99d); + static const IconData payment_card_outline = DSIconData(0xe99e); + static const IconData payment_card_cvc_outline = DSIconData(0xe99f); + static const IconData pix_outline = DSIconData(0xe9a0); + static const IconData plugin_outline = DSIconData(0xe9a1); + static const IconData plus_outline = DSIconData(0xe9a2); + static const IconData primeiro_acesso_outline = DSIconData(0xe9a3); + static const IconData priorization_outline = DSIconData(0xe9a4); + static const IconData qrcode_outline = DSIconData(0xe9a5); + static const IconData question_outline = DSIconData(0xe9a6); + static const IconData redo_outline = DSIconData(0xe9a7); + static const IconData refresh_outline = DSIconData(0xe9a8); + static const IconData refresh_pack_outline = DSIconData(0xe9a9); + static const IconData resources_outline = DSIconData(0xe9aa); + static const IconData restore_outline = DSIconData(0xe9ab); + static const IconData robot_outline = DSIconData(0xe9ac); + static const IconData save_disk_outline = DSIconData(0xe9ad); + static const IconData save_flag_outline = DSIconData(0xe9ae); + static const IconData screen_fill_outline = DSIconData(0xe9af); + static const IconData screen_full_outline = DSIconData(0xe9b0); + static const IconData search_outline = DSIconData(0xe9b1); + static const IconData send_outline = DSIconData(0xe9b2); + static const IconData service_queue_outline = DSIconData(0xe9b3); + static const IconData settings_adjusments_outline = DSIconData(0xe9b4); + static const IconData settings_builder_outline = DSIconData(0xe9b5); + static const IconData settings_general_outline = DSIconData(0xe9b6); + static const IconData share_outline = DSIconData(0xe9b7); + static const IconData skills_outline = DSIconData(0xe9b8); + static const IconData smartphone_outline = DSIconData(0xe9b9); + static const IconData sms_outline = DSIconData(0xe9ba); + static const IconData speaker_outline = DSIconData(0xe9bb); + static const IconData sso_outline = DSIconData(0xe9bc); + static const IconData status_outline = DSIconData(0xe9bd); + static const IconData tag_outline = DSIconData(0xe9be); + static const IconData target_outline = DSIconData(0xe9bf); + static const IconData team_outline = DSIconData(0xe9c0); + static const IconData text_style_bold_outline = DSIconData(0xe9c1); + static const IconData text_style_italic_outline = DSIconData(0xe9c2); + static const IconData text_style_strikethrough_outline = DSIconData(0xe9c3); + static const IconData text_style_underline_outline = DSIconData(0xe9c4); + static const IconData ticket_outline = DSIconData(0xe9c5); + static const IconData time_passed_outline = DSIconData(0xe9c6); + static const IconData transfer_outline = DSIconData(0xe9c7); + static const IconData trash_outline = DSIconData(0xe9c8); + static const IconData trophy_outline = DSIconData(0xe9c9); + static const IconData true_outline = DSIconData(0xe9ca); + static const IconData undo_outline = DSIconData(0xe9cb); + static const IconData unlock_outline = DSIconData(0xe9cc); + static const IconData upload_outline = DSIconData(0xe9cd); + static const IconData user_active_outline = DSIconData(0xe9ce); + static const IconData user_defaut_outline = DSIconData(0xe9cf); + static const IconData user_engaged_outline = DSIconData(0xe9d0); + static const IconData video_outline = DSIconData(0xe9d2); + static const IconData video_broken_outline = DSIconData(0xe9d3); + static const IconData voip_outline = DSIconData(0xe9d4); + static const IconData warning_outline = DSIconData(0xe9d5); + static const IconData xml_outline = DSIconData(0xe9d6); } diff --git a/lib/src/utils/ds_linkify.util.dart b/lib/src/utils/ds_linkify.util.dart index 54f24beb..06ca38a9 100644 --- a/lib/src/utils/ds_linkify.util.dart +++ b/lib/src/utils/ds_linkify.util.dart @@ -28,13 +28,14 @@ abstract class DSLinkify { (child) { final String? spanText = (child as TextSpan).text; final TextStyle? spanStyle = (child.style ?? defaultStyle); + final TextStyle? linkStyle = spanStyle?.copyWith( + color: linkColor, + decoration: TextDecoration.underline, + ); if (spanText?.isNotEmpty ?? false) { final List elements = linkify( spanText!, - linkifiers: const [ - UrlLinkifier(), - ], ); for (var element in elements) { @@ -46,30 +47,42 @@ abstract class DSLinkify { ), ); } else { - final Uri? url = Uri.tryParse( - (element as UrlElement).url, - ); + late final Uri? url; + late final String text; - if (url != null) { - formattedText.add( - TextSpan( - text: url.toString(), - recognizer: TapGestureRecognizer() - ..onTap = () => launchUrl( - url, - mode: LaunchMode.inAppWebView, - ), - style: spanStyle?.copyWith( - color: linkColor, - decoration: TextDecoration.underline, - ), - ), - ); + if (element is UrlElement) { + text = element.url; + url = Uri.tryParse(element.url); + } else if (element is EmailElement) { + text = element.emailAddress; + url = Uri.tryParse(element.url); } + + formattedText.add( + TextSpan( + text: text, + style: linkStyle, + recognizer: TapGestureRecognizer() + ..onTap = () async { + bool hasLaunched = false; + + if (url != null) { + hasLaunched = await launchUrl( + url, + mode: LaunchMode.externalApplication, + ); + } + + if (!hasLaunched) { + throw 'Não abriu a url'; + //TODO: toast + } + }, + ), + ); } } } - return true; }, ); diff --git a/lib/src/utils/ds_message_content_type.util.dart b/lib/src/utils/ds_message_content_type.util.dart index 19555691..e750ee3d 100644 --- a/lib/src/utils/ds_message_content_type.util.dart +++ b/lib/src/utils/ds_message_content_type.util.dart @@ -6,4 +6,5 @@ abstract class DSMessageContentType { static const String documentSelect = 'application/vnd.lime.document-select+json'; static const String webLink = 'application/vnd.lime.web-link+json'; + static const String collection = 'application/vnd.lime.collection+json'; } diff --git a/lib/src/widgets/buttons/ds_attachment_button.widget.dart b/lib/src/widgets/buttons/ds_attachment_button.widget.dart index 48c16b87..67957791 100644 --- a/lib/src/widgets/buttons/ds_attachment_button.widget.dart +++ b/lib/src/widgets/buttons/ds_attachment_button.widget.dart @@ -7,13 +7,9 @@ class DSAttachmentButton extends DSIconButton { required super.onPressed, super.isLoading, }) : super( - icon: const ImageIcon( - size: 20, + icon: const Icon( + DSIcons.attach_outline, color: DSColors.neutralDarkRooftop, - AssetImage( - 'assets/images/clip.png', - package: DSUtils.packageName, - ), ), ); } diff --git a/lib/src/widgets/buttons/ds_button.widget.dart b/lib/src/widgets/buttons/ds_button.widget.dart index 7802ee19..16b4bfa2 100644 --- a/lib/src/widgets/buttons/ds_button.widget.dart +++ b/lib/src/widgets/buttons/ds_button.widget.dart @@ -45,7 +45,7 @@ class DSButton extends StatelessWidget { onPressed: isEnabled && !isLoading ? onPressed : null, style: OutlinedButton.styleFrom( padding: shape == DSButtonShape.rounded - ? const EdgeInsets.all(12.0) + ? const EdgeInsets.all(8.0) : EdgeInsets.symmetric( vertical: _isIconOnly() ? 8.0 : 10.0, horizontal: _isIconOnly() ? 10.0 : 16.0, diff --git a/lib/src/widgets/buttons/ds_icon_button.widget.dart b/lib/src/widgets/buttons/ds_icon_button.widget.dart index ababa7bc..c4e4a94d 100644 --- a/lib/src/widgets/buttons/ds_icon_button.widget.dart +++ b/lib/src/widgets/buttons/ds_icon_button.widget.dart @@ -3,18 +3,17 @@ import 'package:flutter/material.dart'; import '../../themes/colors/ds_colors.theme.dart'; import '../animations/ds_fading_circle_loading.widget.dart'; -const _kSize = Size(44.0, 44.0); - class DSIconButton extends InkWell { DSIconButton({ super.key, required void Function() onPressed, required Widget icon, - bool isLoading = false, + final bool isLoading = false, + final double size = 44.0, }) : super( onTap: isLoading ? null : onPressed, child: SizedBox.fromSize( - size: _kSize, + size: Size(size, size), child: Center( child: isLoading ? const DSFadingCircleLoading( diff --git a/lib/src/widgets/buttons/ds_send_button.widget.dart b/lib/src/widgets/buttons/ds_send_button.widget.dart index b1df97bd..bcdd507e 100644 --- a/lib/src/widgets/buttons/ds_send_button.widget.dart +++ b/lib/src/widgets/buttons/ds_send_button.widget.dart @@ -2,7 +2,7 @@ import 'package:blip_ds/src/enums/ds_button_shape.enum.dart'; import 'package:flutter/material.dart'; import '../../themes/colors/ds_colors.theme.dart'; -import '../../utils/ds_utils.util.dart'; +import '../../themes/icons/ds_icons.dart'; import 'ds_button.widget.dart'; class DSSendButton extends DSButton { @@ -13,12 +13,8 @@ class DSSendButton extends DSButton { super.foregroundColor = DSColors.neutralLightSnow, }) : super( shape: DSButtonShape.rounded, - leadingIcon: const ImageIcon( - size: 20, - AssetImage( - 'assets/images/send_button.png', - package: DSUtils.packageName, - ), + leadingIcon: const Icon( + DSIcons.send_solid, ), ); } diff --git a/lib/src/widgets/chat/ds_carrousel.widget.dart b/lib/src/widgets/chat/ds_carrousel.widget.dart new file mode 100644 index 00000000..7f47019b --- /dev/null +++ b/lib/src/widgets/chat/ds_carrousel.widget.dart @@ -0,0 +1,146 @@ +import 'package:flutter/material.dart'; + +import '../../enums/ds_align.enum.dart'; +import '../../enums/ds_border_radius.enum.dart'; +import '../../models/ds_document_select.model.dart'; +import '../../models/ds_message_bubble_style.model.dart'; +import '../../utils/ds_utils.util.dart'; +import '../utils/ds_card.widget.dart'; + +import 'ds_image_message_bubble.widget.dart'; + +/// A Design System widget used to display multiple cards. +/// +/// The widget receives a json passed by the [content] parameter and displays the information +/// in two ways according to the [itemType] parameter contained in the header. +/// If the [itemType] contains the select parameter, the content is displayed in carousel mode, and if it +/// contains the container parameter, it is displayed in a vertical line. +class DSCarrousel extends StatelessWidget { + /// Sets the card's alignment on the screen. + final DSAlign align; + + /// Json that defines the widget type and content + final Map content; + + /// Card borders for design when used grouped + final List borderRadius; + + /// Selection return callbacks in menus + final void Function(String, Map)? onSelected; + final void Function(Map)? onOpenLink; + + /// Card styling to adjust custom colors + final DSMessageBubbleStyle style; + + DSCarrousel({ + Key? key, + required this.align, + required this.content, + required this.borderRadius, + this.onSelected, + this.onOpenLink, + DSMessageBubbleStyle? style, + }) : style = style ?? DSMessageBubbleStyle(), + super(key: key); + + @override + Widget build(BuildContext context) { + return _buildCollection(); + } + + Widget _buildCollection() { + final children = []; + final String typeCollection; + + (content['itemType'].contains('select')) + ? typeCollection = 'select' + : typeCollection = 'container'; + + final items = content['items']; + + for (final item in items) { + if (typeCollection == 'select') { + final Map? header = item["header"]; + final List options = item["options"]; + + final listOptions = []; + + for (final option in options) { + listOptions.add(DSDocumentSelectOption.fromJson(option)); + } + + children.add( + SizedBox( + width: DSUtils.bubbleMinSize, + child: DSImageMessageBubble( + align: align, + url: header!["value"]["uri"], + title: header["value"]["title"], + text: header["value"]["text"], + appBarText: header["value"]["title"], + selectOptions: listOptions, + showSelect: true, + hasSpacer: false, + onSelected: onSelected, + onOpenLink: onOpenLink, + style: style, + ), + ), + ); + } else { + final contentContainer = item['value']; + final index = items.indexOf(item); + final radius = [DSBorderRadius.topLeft, DSBorderRadius.bottomLeft]; + + if (index == 0 && + borderRadius.any((element) => [ + DSBorderRadius.topRight, + DSBorderRadius.all + ].any((border) => element == border))) { + radius.add(DSBorderRadius.topRight); + } else if (index == items.length - 1 && + borderRadius.any((element) => [ + DSBorderRadius.bottomRight, + DSBorderRadius.all + ].any((border) => element == border))) { + radius.add(DSBorderRadius.bottomRight); + } + + children.add( + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: DSCard( + type: item['type'], + content: contentContainer, + align: align, + style: style, + borderRadius: radius, + customerName: contentContainer['text'], + onSelected: onSelected, + onOpenLink: onOpenLink, + ), + ), + ); + } + } + + return typeCollection == 'select' + ? Padding( + padding: const EdgeInsets.only(top: 8.0), + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + scrollDirection: Axis.horizontal, + physics: const BouncingScrollPhysics(), + child: Wrap( + spacing: 16.0, + alignment: WrapAlignment.start, + children: children, + ), + ), + ) + : Column( + mainAxisSize: MainAxisSize.min, + children: children, + ); + } +} diff --git a/lib/src/widgets/chat/ds_file_message_bubble.widget.dart b/lib/src/widgets/chat/ds_file_message_bubble.widget.dart index 9bb820f1..ab22947d 100644 --- a/lib/src/widgets/chat/ds_file_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_file_message_bubble.widget.dart @@ -6,7 +6,6 @@ import '../../enums/ds_align.enum.dart'; import '../../enums/ds_border_radius.enum.dart'; import '../../models/ds_message_bubble_style.model.dart'; import '../../themes/colors/ds_colors.theme.dart'; -import '../../utils/ds_utils.util.dart'; import '../animations/ds_fading_circle_loading.widget.dart'; import '../texts/ds_body_text.widget.dart'; import '../texts/ds_caption_small_text.widget.dart'; @@ -68,15 +67,7 @@ class DSFileMessageBubble extends StatelessWidget { : Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.asset( - controller.getAsset(filename), - height: 42.0, - package: DSUtils.packageName, - errorBuilder: (_, __, ___) => Image.asset( - 'assets/images/file-default.png', - package: DSUtils.packageName, - ), - ) + controller.getFileIcon(filename), ], ), ), diff --git a/lib/src/widgets/chat/ds_image_message_bubble.widget.dart b/lib/src/widgets/chat/ds_image_message_bubble.widget.dart index bef403cb..9a07a2a8 100644 --- a/lib/src/widgets/chat/ds_image_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_image_message_bubble.widget.dart @@ -1,18 +1,21 @@ import 'package:flutter/material.dart'; + import 'package:get/get.dart'; import 'package:pinch_zoom/pinch_zoom.dart'; + +import '../../controllers/chat/ds_image_message_bubble.controller.dart'; import '../../enums/ds_align.enum.dart'; import '../../enums/ds_border_radius.enum.dart'; +import '../../models/ds_document_select.model.dart'; import '../../models/ds_message_bubble_style.model.dart'; import '../../themes/colors/ds_colors.theme.dart'; import '../../themes/icons/ds_icons.dart'; import '../../utils/ds_utils.util.dart'; -import '../../models/ds_document_select.model.dart'; -import '../../controllers/chat/ds_image_message_bubble.controller.dart'; import '../texts/ds_caption_text.widget.dart'; import '../texts/ds_headline_small_text.widget.dart'; import '../utils/ds_cached_network_image_view.widget.dart'; import '../utils/ds_user_avatar.widget.dart'; + import 'ds_document_select.widget.dart'; import 'ds_message_bubble.widget.dart'; import 'ds_show_more_text.widget.dart'; @@ -27,6 +30,7 @@ class DSImageMessageBubble extends StatefulWidget { this.borderRadius = const [DSBorderRadius.all], this.text, this.title, + this.hasSpacer = true, DSMessageBubbleStyle? style, this.selectOptions = const [], this.showSelect = false, @@ -38,6 +42,7 @@ class DSImageMessageBubble extends StatefulWidget { final String url; final List borderRadius; final String? title; + final bool hasSpacer; final String? text; final String appBarText; final Uri? appBarPhotoUri; @@ -76,6 +81,7 @@ class _DSImageMessageBubbleState extends State align: widget.align, borderRadius: widget.borderRadius, padding: EdgeInsets.zero, + hasSpacer: widget.hasSpacer, style: widget.style, child: FutureBuilder( future: _controller.getImageInfo(widget.url), @@ -144,18 +150,17 @@ class _DSImageMessageBubbleState extends State color: color, ), if ((widget.text?.isNotEmpty ?? false) && - (widget.title?.isNotEmpty ?? false)) ...[ + (widget.title?.isNotEmpty ?? false)) const SizedBox( height: 6.0, ), - if (widget.text?.isNotEmpty ?? false) - DSShowMoreText( - text: widget.text!, - maxWidth: constraints.maxWidth, - align: widget.align, - style: widget.style, - ) - ] + if (widget.text?.isNotEmpty ?? false) + DSShowMoreText( + text: widget.text!, + maxWidth: constraints.maxWidth, + align: widget.align, + style: widget.style, + ) ], ), ), @@ -209,7 +214,7 @@ class _DSImageMessageBubbleState extends State padding: EdgeInsets.zero, onPressed: () => Navigator.of(context).pop(), icon: const Icon( - DSIcons.arrow_left, + DSIcons.arrow_left_outline, color: DSColors.neutralLightSnow, size: 32.0, ), diff --git a/lib/src/widgets/chat/ds_message_bubble.widget.dart b/lib/src/widgets/chat/ds_message_bubble.widget.dart index 04f91d0f..e4dab7ec 100644 --- a/lib/src/widgets/chat/ds_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_message_bubble.widget.dart @@ -15,6 +15,7 @@ class DSMessageBubble extends StatelessWidget { final double defaultMaxSize; final double defaultMinSize; final DSMessageBubbleStyle style; + final bool hasSpacer; const DSMessageBubble({ Key? key, @@ -29,6 +30,7 @@ class DSMessageBubble extends StatelessWidget { this.defaultMaxSize = DSUtils.bubbleMaxSize, this.defaultMinSize = DSUtils.bubbleMinSize, required this.style, + this.hasSpacer = true, }) : super(key: key); BorderRadius _getBorderRadius() { @@ -70,7 +72,10 @@ class DSMessageBubble extends StatelessWidget { @override Widget build(BuildContext context) { final isRightAlign = align == DSAlign.right; - List children = [const Spacer(), _messageContainer()]; + List children = [ + if (hasSpacer) const Spacer(), + _messageContainer(), + ]; return Column( children: [ diff --git a/lib/src/widgets/chat/ds_text_message_bubble.widget.dart b/lib/src/widgets/chat/ds_text_message_bubble.widget.dart index 84ae8241..ae203667 100644 --- a/lib/src/widgets/chat/ds_text_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_text_message_bubble.widget.dart @@ -1,13 +1,15 @@ import 'package:flutter/material.dart'; + import '../../enums/ds_align.enum.dart'; import '../../enums/ds_border_radius.enum.dart'; import '../../models/ds_message_bubble_style.model.dart'; import '../../themes/colors/ds_colors.theme.dart'; import '../../utils/ds_linkify.util.dart'; + import 'ds_message_bubble.widget.dart'; -import 'ds_url_preview.widget.dart'; import 'ds_select_menu.widget.dart'; import 'ds_show_more_text.widget.dart'; +import 'ds_url_preview.widget.dart'; class DSTextMessageBubble extends StatefulWidget { final String text; diff --git a/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart b/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart index 861a650b..24e563ef 100644 --- a/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart @@ -40,7 +40,7 @@ class DSUnsupportedContentMessageBubble extends StatelessWidget { children: [ leftWidget ?? Icon( - DSIcons.false_icon, + DSIcons.false_outline, color: style.isLightBubbleBackground(align) ? DSColors.neutralDarkCity : DSColors.neutralLightSnow, @@ -49,7 +49,7 @@ class DSUnsupportedContentMessageBubble extends StatelessWidget { Padding( padding: const EdgeInsets.only(left: 8.0), child: DSBodyText( - text ?? 'Unsupported content', + text ?? 'Unsupported content', // TODO: Need localized translate. color: color, ), ), diff --git a/lib/src/widgets/chat/typing/ds_typing_dot_animation.widget.dart b/lib/src/widgets/chat/typing/ds_typing_dot_animation.widget.dart index 43bcfc99..49d28f43 100644 --- a/lib/src/widgets/chat/typing/ds_typing_dot_animation.widget.dart +++ b/lib/src/widgets/chat/typing/ds_typing_dot_animation.widget.dart @@ -109,7 +109,12 @@ class _DSTypingDotAnimationState extends State Future.delayed( const Duration(milliseconds: 120), ).then( - (value) => _animationControllers![i + 1].forward(), + (value) { + final controller = _animationControllers![i + 1]; + if (!controller.isDismissed) { + controller.forward(); + } + }, ); } } else if (status == AnimationStatus.completed) { diff --git a/lib/src/widgets/chat/video/ds_video_player.widget.dart b/lib/src/widgets/chat/video/ds_video_player.widget.dart index 7ce66aa7..416be3e4 100644 --- a/lib/src/widgets/chat/video/ds_video_player.widget.dart +++ b/lib/src/widgets/chat/video/ds_video_player.widget.dart @@ -69,7 +69,7 @@ class DSVideoPlayer extends StatelessWidget { Get.back(); }, icon: const Icon( - DSIcons.arrow_left, + DSIcons.arrow_left_outline, color: DSColors.neutralLightSnow, size: 32.0, ), diff --git a/lib/src/widgets/utils/ds_cached_network_image_view.widget.dart b/lib/src/widgets/utils/ds_cached_network_image_view.widget.dart index 597c193e..73f4fefc 100644 --- a/lib/src/widgets/utils/ds_cached_network_image_view.widget.dart +++ b/lib/src/widgets/utils/ds_cached_network_image_view.widget.dart @@ -64,7 +64,7 @@ class DSCachedNetworkImageView extends StatelessWidget { return Padding( padding: const EdgeInsets.symmetric(vertical: 80), child: Icon( - DSIcons.file_image_broken, + DSIcons.file_image_broken_outline, color: style.isLightBubbleBackground(align) ? DSColors.neutralMediumElephant : DSColors.neutralMediumCloud, diff --git a/lib/src/widgets/utils/ds_card.widget.dart b/lib/src/widgets/utils/ds_card.widget.dart index 7189d177..c6f655bb 100644 --- a/lib/src/widgets/utils/ds_card.widget.dart +++ b/lib/src/widgets/utils/ds_card.widget.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; + import 'package:blip_ds/blip_ds.dart'; -import 'package:blip_ds/src/utils/ds_message_content_type.util.dart'; + import '../../models/ds_document_select.model.dart'; +import '../../utils/ds_message_content_type.util.dart'; /// A Design System widget used to display a Design System's widget based in LIME protocol content types class DSCard extends StatelessWidget { @@ -53,6 +55,16 @@ class DSCard extends StatelessWidget { case DSMessageContentType.documentSelect: return _buildDocumentSelect(); + case DSMessageContentType.collection: + return DSCarrousel( + align: align, + content: content, + borderRadius: borderRadius, + onSelected: onSelected, + onOpenLink: onOpenLink, + style: style, + ); + default: return DSUnsupportedContentMessageBubble( align: align, diff --git a/lib/src/widgets/utils/ds_group_card.widget.dart b/lib/src/widgets/utils/ds_group_card.widget.dart index 207fb2d0..0a98b4b3 100644 --- a/lib/src/widgets/utils/ds_group_card.widget.dart +++ b/lib/src/widgets/utils/ds_group_card.widget.dart @@ -138,7 +138,7 @@ class _DSGroupCardState extends State { ); }, leadingIcon: const Icon( - DSIcons.arrow_down, + DSIcons.arrow_down_outline, size: 20, ), backgroundColor: DSColors.neutralLightSnow, diff --git a/lib/src/widgets/utils/ds_header.widget.dart b/lib/src/widgets/utils/ds_header.widget.dart index 44a5b3e8..e0745b25 100644 --- a/lib/src/widgets/utils/ds_header.widget.dart +++ b/lib/src/widgets/utils/ds_header.widget.dart @@ -81,7 +81,7 @@ class DSHeader extends StatelessWidget implements PreferredSizeWidget { onPressed: onBackButtonPressed ?? Navigator.of(context).pop, iconSize: 28, icon: const Icon( - DSIcons.arrow_left, + DSIcons.arrow_left_outline, color: DSColors.neutralDarkRooftop, ), ) diff --git a/pubspec.yaml b/pubspec.yaml index 419f53b1..99ca0169 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.0.16 +version: 0.0.17 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter @@ -29,13 +29,17 @@ dependencies: simple_animations: ^5.0.0 chewie: ^1.3.4 video_player: ^2.4.7 + sticky_headers: ^0.3.0 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 + golden_toolkit: ^0.13.0 flutter: + uses-material-design: true + assets: - assets/images/ diff --git a/sample/assets/messages.json b/sample/assets/messages.json index 60b8ce19..2e002e15 100644 --- a/sample/assets/messages.json +++ b/sample/assets/messages.json @@ -1,461 +1,637 @@ [ - { - "date": "2022-08-22T17:10:00.938Z", - "displayDate": "8 de Ago de 2022 17:10", - "align": "right", - "status": "consumed", - "type": "application/vnd.lime.document-select+json", - "content": { - "header": { + { + "date": "2022-08-22T17:10:00.938Z", + "displayDate": "8 de Ago de 2022 17:10", + "align": "right", + "status": "consumed", + "type": "application/vnd.lime.document-select+json", + "content": { + "header": { + "type": "application/vnd.lime.media-link+json", + "value": { + "title": "Welcome to mad hatter", + "text": "Here we have the best hats for your head.", + "type": "image/jpeg", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb3", + "uri": "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg", + "aspectRatio": "1:1" + } + }, + "options": [ + { + "label": { + "type": "application/vnd.lime.web-link+json", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb2", + "value": { + "text": "Go to our site", + "title": "Title test", + "uri": "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg" + } + } + }, + { + "label": { + "type": "text/plain", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb4", + "value": "option text com payload" + }, + "value": { + "type": "application/json", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb5", + "value": { + "action": "show-items" + } + } + }, + { + "label": { + "type": "text/plain", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb6", + "value": "option text sem payload" + } + } + ] + }, + "id:": "c37b66a6-b60f-4bc0-af30-7c9b28874cb1" + }, + { + "content": { + "scope": "immediate", + "text": "Lorem ipsum is the most popular filler text in history.", + "options": [ + { + "text": "Sim", + "type": "text/plain", + "value": "payload" + }, + { + "order": 1, + "text": "Não" + }, + { + "text": "Talvez" + } + ] + }, + "date": "2022-08-22T17:05:00.938Z", + "displayDate": "8 de Ago de 2022 17:05", + "align": "right", + "id": "fwd:fwd:c37b66a6-b60f-4bc0-af30-7c9b28874cba", + "metadata": { + "#messageEmitter": "Human", + "#messageKind": "Response", + "#uniqueId": "7762e5d6-032f-4007-92ef-e2e90c52598b", + "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", + "$elapsedTimeToStorage": "00:00:00.0431445", + "$internalId": "7762e5d6-032f-4007-92ef-e2e90c52598b", + "$originator": "andrebot@msging.net", + "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", + "date_created": "1663006016315", + "uber-trace-id": "4cbf0cc1a52eb4b4%3A3d89aa908942bbf4%3Ae96ca5132dd591af%3A1" + }, + "status": "consumed", + "type": "application/vnd.lime.select+json" + }, + { + "content": { + "scope": "immediate", + "text": "Lorem ipsum is the most popular filler text in history.", + "options": [ + { + "text": "Sim", + "type": "text/plain", + "value": "payload" + }, + { + "text": "Não" + }, + { + "text": "Talvez" + } + ] + }, + "date": "2022-08-22T17:05:00.938Z", + "displayDate": "8 de Ago de 2022 17:05", + "align": "left", + "id": "fwd:fwd:c37b66a6-b60f-4bc0-af30-7c9b28874cba", + "metadata": { + "#messageEmitter": "Human", + "#messageKind": "Response", + "#uniqueId": "7762e5d6-032f-4007-92ef-e2e90c52598b", + "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", + "$elapsedTimeToStorage": "00:00:00.0431445", + "$internalId": "7762e5d6-032f-4007-92ef-e2e90c52598b", + "$originator": "andrebot@msging.net", + "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", + "date_created": "1663006016315", + "uber-trace-id": "4cbf0cc1a52eb4b4%3A3d89aa908942bbf4%3Ae96ca5132dd591af%3A1" + }, + "status": "consumed", + "type": "application/vnd.lime.select+json" + }, + { + "content": { + "previewType": "image/png", + "previewUri": "https://picsum.photos/250?image=9", + "size": 500, + "text": "legenda", + "title": "Double check.png", + "type": "image/png", + "uri": "https://picsum.photos/250?image=9" + }, + "date": "2022-08-22T17:00:00.938Z", + "displayDate": "8 de Ago de 2022 17:00", + "align": "right", + "type": "application/vnd.lime.media-link+json", + "status": "consumed", + "customerName": "André Rossi", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbb" + }, + { + "content": { + "scope": "immediate", + "text": "Qual a resposta certa?", + "options": [ + { + "text": "Opção 1", + "order": 3, + "type": "application/json", + "value": { + "key1": "value1", + "key2": 2 + } + }, + { + "text": "Opção 2" + }, + { + "text": "Opção 3" + }, + { + "text": "Opção 4" + }, + { + "text": "Opção 5" + }, + { + "text": "Opção 6" + }, + { + "text": "Opção 7" + } + ] + }, + "date": "2022-08-22T17:00:00.938Z", + "displayDate": "8 de Ago de 2022 17:00", + "align": "right", + "id": "fwd:fwd:c37b66a6-b60f-4bc0-af30-7c9b28874cba", + "metadata": { + "#messageEmitter": "Human", + "#messageKind": "Response", + "#uniqueId": "7762e5d6-032f-4007-92ef-e2e90c52598b", + "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", + "$elapsedTimeToStorage": "00:00:00.0431445", + "$internalId": "7762e5d6-032f-4007-92ef-e2e90c52598b", + "$originator": "andrebot@msging.net", + "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", + "date_created": "1663006016315", + "uber-trace-id": "4cbf0cc1a52eb4b4%3A3d89aa908942bbf4%3Ae96ca5132dd591af%3A1" + }, + "status": "consumed", + "type": "application/vnd.lime.select+json" + }, + { + "content": { + "text": "Você gostaria de um atendimento humano?", + "options": [ + { + "text": "Sim", + "type": "text/plain", + "value": "payload do sim" + }, + { + "text": "Não", + "order": 1 + }, + { + "text": "Talvez" + }, + { + "text": "Outro", + "type": "application/json", + "value": { + "chave": "valor" + } + } + ] + }, + "date": "2022-08-22T17:00:00.938Z", + "displayDate": "8 de Ago de 2022 17:00", + "align": "right", + "id": "fwd:fwd:6e2a9b6e-4fbd-4618-9d33-c6d21cb03e5e", + "metadata": { + "#messageEmitter": "Human", + "#messageKind": "Response", + "#uniqueId": "2f1cadef-c1ec-4e1d-9f69-4cf77969d056", + "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", + "$elapsedTimeToStorage": "00:00:00.0427753", + "$internalId": "2f1cadef-c1ec-4e1d-9f69-4cf77969d056", + "$originator": "andrebot@msging.net", + "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", + "date_created": "1663003204269", + "uber-trace-id": "e25633b1df40928f%3A5ef353780afbcc13%3A9a5c45672de0a5e7%3A1" + }, + "status": "consumed", + "type": "application/vnd.lime.select+json" + }, + { + "content": { + "previewType": "image/png", + "previewUri": "https://picsum.photos/250?image=9", + "size": 500, + "text": "legenda", + "title": "Double check.png", + "type": "image/png", + "uri": "https://picsum.photos/250?image=9" + }, + "date": "2022-08-22T17:00:00.938Z", + "displayDate": "8 de Ago de 2022 17:00", + "align": "right", + "type": "application/vnd.lime.media-link+json", + "status": "consumed", + "customerName": "André Rossi", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbc" + }, + { + "content": { + "previewType": "application/pdf", + "previewUri": "https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf", + "size": 1203179, + "text": "legenda do pdf", + "title": "teste.pdf", + "type": "application/pdf", + "uri": "https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf" + }, + "date": "2022-08-22T16:20:00.938Z", + "displayDate": "8 de Ago de 2022 16:20", + "align": "right", + "type": "application/vnd.lime.media-link+json", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbd" + }, + { + "content": { + "previewType": "audio/mpeg", + "previewUri": "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3", + "size": 61056, + "text": "", + "title": "1661185184764.mp3", + "type": "audio/mpeg", + "uri": "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3" + }, + "date": "2022-08-22T16:19:58.938Z", + "displayDate": "8 de Ago de 2022 16:19", + "align": "right", + "type": "application/vnd.lime.media-link+json", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbe" + }, + { + "content": "vou mandar audio", + "date": "2022-08-22T12:35:43.717Z", + "displayDate": "8 de Ago de 2022 12:35", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb1" + }, + { + "content": "pode me ajudar?", + "date": "2022-08-22T12:35:38.704Z", + "displayDate": "8 de Ago de 2022 12:35", + "align": "left", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb2" + }, + { + "content": "estou com problema no login", + "date": "2022-08-22T12:34:20.577Z", + "displayDate": "8 de Ago de 2022 12:34", + "align": "left", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb3" + }, + { + "content": "sim", + "date": "2022-08-22T12:34:19.554Z", + "displayDate": "8 de Ago de 2022 12:34", + "align": "left", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb4" + }, + { + "content": "olá", + "date": "2022-08-22T12:34:12.788Z", + "displayDate": "8 de Ago de 2022 12:34", + "align": "left", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb5" + }, + { + "content": "até mais!", + "date": "2022-09-22T12:30:01.035Z", + "displayDate": "22 de Set de 2022 12:30", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb6" + }, + { + "content": "ta por ai?", + "date": "2022-08-22T12:33:18.899Z", + "displayDate": "8 de Ago de 2022 12:33", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb7" + }, + { + "content": "precisa de ajuda?", + "date": "2022-08-22T12:25:26.684Z", + "displayDate": "8 de Ago de 2022 12:25", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb8" + }, + { + "content": "tudo bem?", + "date": "2022-08-22T12:25:24.362Z", + "displayDate": "8 de Ago de 2022 12:25", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb9" + }, + { + "content": "oi", + "date": "2022-08-22T12:25:23.189Z", + "displayDate": "8 de Ago de 2022 12:25", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbf" + }, + { + "content": "1", + "date": "2022-08-22T12:25:02.934Z", + "displayDate": "8 de Ago de 2022 12:25", + "align": "left", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874ccd" + }, + { + "content": "1 - falar com humano", + "date": "2022-08-22T12:25:01.050Z", + "displayDate": "8 de Ago de 2022 12:25", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cdd" + }, + { + "content": "Olá! Tester 22-08-22 09:24:51!\nSeja bem-vindo(a)!", + "date": "2022-08-22T12:25:01.035Z", + "displayDate": "8 de Ago de 2022 12:25", + "align": "right", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874ced" + }, + { + "content": "ola", + "date": "2022-08-22T12:24:57.928Z", + "displayDate": "8 de Ago de 2022 12:24", + "align": "left", + "type": "text/plain", + "status": "consumed", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cfd" + }, + { + "content": { + "previewType": "video/wmv", + "previewUri": "https://assets.mixkit.co/videos/preview/mixkit-a-girl-blowing-a-bubble-gum-at-an-amusement-park-1226-large.mp4", + "size": 500, + "text": "Vídeo válido", + "title": "Double check.png", + "type": "video/wmv", + "uri": "https://assets.mixkit.co/videos/preview/mixkit-a-girl-blowing-a-bubble-gum-at-an-amusement-park-1226-large.mp4" + }, + "date": "2022-08-22T12:21:01.938Z", + "displayDate": "8 de Ago de 2022 12:21", + "align": "right", + "type": "application/vnd.lime.media-link+json", + "status": "consumed", + "customerName": "André Rossi", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874dbd" + }, + { + "content": { + "previewType": "video/mp4", + "previewUri": "https://filesamples.com/samples/video/wmv/sample_960x400_ocean_with_audio.wmv", + "size": 500, + "text": "Vídeo inválido", + "title": "Double check.png", + "type": "video/mp4", + "uri": "https://filesamples.com/samples/video/wmv/sample_960x400_ocean_with_audio.wmv" + }, + "date": "2022-08-22T12:21:02.938Z", + "displayDate": "8 de Ago de 2022 12:22", + "align": "left", + "type": "application/vnd.lime.media-link+json", + "status": "consumed", + "customerName": "André Rossi", + "id": "c37b66a6-b60f-4bc0-af30-7c9b28874fbd" + }, + { + "id": "5", + "to": "1042221589186385@messenger.gw.msging.net", + "type": "application/vnd.lime.collection+json", + "date": "2022-08-22T12:21:01.938Z", + "displayDate": "08 de Ago de 2022 12:21", + "align": "right", + "status": "consumed", + "content": { + "itemType": "application/vnd.lime.document-select+json", + "items": [ + { + "header": { "type": "application/vnd.lime.media-link+json", "value": { - "title": "Welcome to mad hatter", - "text": "Here we have the best hats for your head.", - "type": "image/jpeg", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb3", - "uri": "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg", - "aspectRatio": "1:1" + "title": "Title", + "text": "This is a first item", + "type": "image/jpeg", + "uri": "http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg" } - }, - "options": [ - { - "label": { - "type": "application/vnd.lime.web-link+json", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb2", - "value": { - "text": "Go to our site", - "title": "Title test", - "uri": "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg" - } - } - }, + }, + "options": [ { - "label": { - "type": "text/plain", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb4", - "value": "option text com payload" - }, - "value": { - "type": "application/json", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb5", - "value": { - "action": "show-items" - } - } + "label": { + "type": "application/vnd.lime.web-link+json", + "value": { + "title": "Link", + "text": "Weblink", + "uri": "https://server.com/first/link1" + } + } }, { - "label": { - "type": "text/plain", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb6", - "value": "option text sem payload" - } + "label": { "type": "text/plain", "value": "Text 1" }, + "value": { + "type": "application/json", + "value": { "key1": "value1", "key2": 2 } + } } - ] - }, - "id:": "c37b66a6-b60f-4bc0-af30-7c9b28874cb1" - }, - { - "content": { - "scope": "immediate", - "text": "Lorem ipsum is the most popular filler text in history.", - "options": [ - { - "text": "Sim", - "type": "text/plain", - "value": "payload" - }, - { - "order": 1, - "text": "Não" - }, - { - "text": "Talvez" + ] + }, + { + "header": { + "type": "application/vnd.lime.media-link+json", + "value": { + "title": "Title 2", + "text": "This is another item", + "type": "image/jpeg", + "uri": "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg" } - ] - }, - "date": "2022-08-22T17:05:00.938Z", - "displayDate": "8 de Ago de 2022 17:05", - "align": "right", - "id": "fwd:fwd:c37b66a6-b60f-4bc0-af30-7c9b28874cba", - "metadata": { - "#messageEmitter": "Human", - "#messageKind": "Response", - "#uniqueId": "7762e5d6-032f-4007-92ef-e2e90c52598b", - "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", - "$elapsedTimeToStorage": "00:00:00.0431445", - "$internalId": "7762e5d6-032f-4007-92ef-e2e90c52598b", - "$originator": "andrebot@msging.net", - "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", - "date_created": "1663006016315", - "uber-trace-id": "4cbf0cc1a52eb4b4%3A3d89aa908942bbf4%3Ae96ca5132dd591af%3A1" - }, - "status": "consumed", - "type": "application/vnd.lime.select+json" - }, - { - "content": { - "scope": "immediate", - "text": "Lorem ipsum is the most popular filler text in history.", - "options": [ + }, + "options": [ { - "text": "Sim", - "type": "text/plain", - "value": "payload" + "label": { + "type": "application/vnd.lime.web-link+json", + "value": { + "title": "Second link", + "text": "Weblink", + "uri": "https://server.com/second/link2" + } + } }, { - "text": "Não" + "label": { "type": "text/plain", "value": "Second text" }, + "value": { + "type": "application/json", + "value": { "key3": "value3", "key4": 4 } + } }, { - "text": "Talvez" + "label": { "type": "text/plain", "value": "More one text" }, + "value": { + "type": "application/json", + "value": { "key5": "value5", "key6": "6" } + } } - ] - }, - "date": "2022-08-22T17:05:00.938Z", - "displayDate": "8 de Ago de 2022 17:05", - "align": "left", - "id": "fwd:fwd:c37b66a6-b60f-4bc0-af30-7c9b28874cba", - "metadata": { - "#messageEmitter": "Human", - "#messageKind": "Response", - "#uniqueId": "7762e5d6-032f-4007-92ef-e2e90c52598b", - "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", - "$elapsedTimeToStorage": "00:00:00.0431445", - "$internalId": "7762e5d6-032f-4007-92ef-e2e90c52598b", - "$originator": "andrebot@msging.net", - "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", - "date_created": "1663006016315", - "uber-trace-id": "4cbf0cc1a52eb4b4%3A3d89aa908942bbf4%3Ae96ca5132dd591af%3A1" - }, - "status": "consumed", - "type": "application/vnd.lime.select+json" - }, - { - "content": { - "previewType": "image/png", - "previewUri": "https://picsum.photos/250?image=9", - "size": 500, - "text": "legenda", - "title": "Double check.png", - "type": "image/png", - "uri": "https://picsum.photos/250?image=9" - }, - "date": "2022-08-22T17:00:00.938Z", - "displayDate": "8 de Ago de 2022 17:00", - "align": "right", - "type": "application/vnd.lime.media-link+json", - "status": "consumed", - "customerName": "André Rossi", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbb" - }, - { - "content": { - "scope": "immediate", - "text": "Qual a resposta certa?", - "options": [ - { - "text": "Opção 1", - "order": 3, - "type": "application/json", - "value": { - "key1": "value1", - "key2": 2 - } - }, - { - "text": "Opção 2" - }, - { - "text": "Opção 3" - }, - { - "text": "Opção 4" - }, - { - "text": "Opção 5" - }, - { - "text": "Opção 6" - }, - { - "text": "Opção 7" + ] + }, + { + "header": { + "type": "application/vnd.lime.media-link+json", + "value": { + "title": "Title 3", + "text": "This is another item", + "type": "image/jpeg", + "uri": "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg" } - ] - }, - "date": "2022-08-22T17:00:00.938Z", - "displayDate": "8 de Ago de 2022 17:00", - "align": "right", - "id": "fwd:fwd:c37b66a6-b60f-4bc0-af30-7c9b28874cba", - "metadata": { - "#messageEmitter": "Human", - "#messageKind": "Response", - "#uniqueId": "7762e5d6-032f-4007-92ef-e2e90c52598b", - "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", - "$elapsedTimeToStorage": "00:00:00.0431445", - "$internalId": "7762e5d6-032f-4007-92ef-e2e90c52598b", - "$originator": "andrebot@msging.net", - "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", - "date_created": "1663006016315", - "uber-trace-id": "4cbf0cc1a52eb4b4%3A3d89aa908942bbf4%3Ae96ca5132dd591af%3A1" - }, - "status": "consumed", - "type": "application/vnd.lime.select+json" - }, - { - "content": { - "text": "Você gostaria de um atendimento humano?", - "options": [ - { - "text": "Sim", - "type": "text/plain", - "value": "payload do sim" - }, + }, + "options": [ { - "text": "Não", - "order": 1 + "label": { + "type": "application/vnd.lime.web-link+json", + "value": { + "title": "Second link", + "text": "Weblink", + "uri": "https://server.com/second/link2" + } + } }, { - "text": "Talvez" + "label": { "type": "text/plain", "value": "Second text" }, + "value": { + "type": "application/json", + "value": { "key3": "value3", "key4": 4 } + } }, { - "text": "Outro", - "type": "application/json", - "value": { - "chave": "valor" - } + "label": { "type": "text/plain", "value": "More one text" }, + "value": { + "type": "application/json", + "value": { "key5": "value5", "key6": "6" } + } } - ] - }, - "date": "2022-08-22T17:00:00.938Z", - "displayDate": "8 de Ago de 2022 17:00", - "align": "right", - "id": "fwd:fwd:6e2a9b6e-4fbd-4618-9d33-c6d21cb03e5e", - "metadata": { - "#messageEmitter": "Human", - "#messageKind": "Response", - "#uniqueId": "2f1cadef-c1ec-4e1d-9f69-4cf77969d056", - "$claims": "Node=andrebot@msging.net/msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4;Identity=andrebot@msging.net;DomainRole=Member;AuthenticationScheme=Transport", - "$elapsedTimeToStorage": "00:00:00.0427753", - "$internalId": "2f1cadef-c1ec-4e1d-9f69-4cf77969d056", - "$originator": "andrebot@msging.net", - "$originatorSessionRemoteNode": "builder.hosting@msging.net/#msging-application-builder-hosting-standard-6dfb4cdb4f-fxsx4", - "date_created": "1663003204269", - "uber-trace-id": "e25633b1df40928f%3A5ef353780afbcc13%3A9a5c45672de0a5e7%3A1" - }, - "status": "consumed", - "type": "application/vnd.lime.select+json" - }, - { - "content": { - "previewType": "image/png", - "previewUri": "https://picsum.photos/250?image=9", - "size": 500, - "text": "legenda", - "title": "Double check.png", - "type": "image/png", - "uri": "https://picsum.photos/250?image=9" - }, - "date": "2022-08-22T17:00:00.938Z", - "displayDate": "8 de Ago de 2022 17:00", - "align": "right", - "type": "application/vnd.lime.media-link+json", - "status": "consumed", - "customerName": "André Rossi", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbc" - }, - { - "content": { - "previewType": "application/pdf", - "previewUri": "https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf", - "size": 1203179, - "text": "legenda do pdf", - "title": "teste.pdf", - "type": "application/pdf", - "uri": "https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf" - }, - "date": "2022-08-22T16:20:00.938Z", - "displayDate": "8 de Ago de 2022 16:20", - "align": "right", - "type": "application/vnd.lime.media-link+json", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbd" - }, - { - "content": { - "previewType": "audio/mpeg", - "previewUri": "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3", - "size": 61056, - "text": "", - "title": "1661185184764.mp3", - "type": "audio/mpeg", - "uri": "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3" - }, - "date": "2022-08-22T16:19:58.938Z", - "displayDate": "8 de Ago de 2022 16:19", - "align": "right", - "type": "application/vnd.lime.media-link+json", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbe" - }, - { - "content": "vou mandar audio", - "date": "2022-08-22T12:35:43.717Z", - "displayDate": "8 de Ago de 2022 12:35", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb1" - }, - { - "content": "pode me ajudar?", - "date": "2022-08-22T12:35:38.704Z", - "displayDate": "8 de Ago de 2022 12:35", - "align": "left", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb2" - }, - { - "content": "estou com problema no login", - "date": "2022-08-22T12:34:20.577Z", - "displayDate": "8 de Ago de 2022 12:34", - "align": "left", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb3" - }, - { - "content": "sim", - "date": "2022-08-22T12:34:19.554Z", - "displayDate": "8 de Ago de 2022 12:34", - "align": "left", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb4" - }, - { - "content": "olá", - "date": "2022-08-22T12:34:12.788Z", - "displayDate": "8 de Ago de 2022 12:34", - "align": "left", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb5" - }, - { - "content": "até mais!", - "date": "2022-09-22T12:30:01.035Z", - "displayDate": "22 de Set de 2022 12:30", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb6" - }, - { - "content": "ta por ai?", - "date": "2022-08-22T12:33:18.899Z", - "displayDate": "8 de Ago de 2022 12:33", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb7" - }, - { - "content": "precisa de ajuda?", - "date": "2022-08-22T12:25:26.684Z", - "displayDate": "8 de Ago de 2022 12:25", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb8" - }, - { - "content": "tudo bem?", - "date": "2022-08-22T12:25:24.362Z", - "displayDate": "8 de Ago de 2022 12:25", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cb9" - }, - { - "content": "oi", - "date": "2022-08-22T12:25:23.189Z", - "displayDate": "8 de Ago de 2022 12:25", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cbf" - }, - { - "content": "1", - "date": "2022-08-22T12:25:02.934Z", - "displayDate": "8 de Ago de 2022 12:25", - "align": "left", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874ccd" - }, - { - "content": "1 - falar com humano", - "date": "2022-08-22T12:25:01.050Z", - "displayDate": "8 de Ago de 2022 12:25", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cdd" - }, - { - "content": "Olá! Tester 22-08-22 09:24:51!\nSeja bem-vindo(a)!", - "date": "2022-08-22T12:25:01.035Z", - "displayDate": "8 de Ago de 2022 12:25", - "align": "right", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874ced" - }, - { - "content": "ola", - "date": "2022-08-22T12:24:57.928Z", - "displayDate": "8 de Ago de 2022 12:24", - "align": "left", - "type": "text/plain", - "status": "consumed", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874cfd" - }, - { - "content": { - "previewType": "video/wmv", - "previewUri": "https://assets.mixkit.co/videos/preview/mixkit-a-girl-blowing-a-bubble-gum-at-an-amusement-park-1226-large.mp4", - "size": 500, - "text": "Vídeo válido", - "title": "Double check.png", - "type": "video/wmv", - "uri": "https://assets.mixkit.co/videos/preview/mixkit-a-girl-blowing-a-bubble-gum-at-an-amusement-park-1226-large.mp4" - }, - "date": "2022-08-22T12:21:01.938Z", - "displayDate": "8 de Ago de 2022 12:21", - "align": "right", - "type": "application/vnd.lime.media-link+json", - "status": "consumed", - "customerName": "André Rossi", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874dbd" - }, - { - "content": { - "previewType": "video/mp4", - "previewUri": "https://filesamples.com/samples/video/wmv/sample_960x400_ocean_with_audio.wmv", - "size": 500, - "text": "Vídeo inválido", - "title": "Double check.png", - "type": "video/mp4", - "uri": "https://filesamples.com/samples/video/wmv/sample_960x400_ocean_with_audio.wmv" - }, - "date": "2022-08-22T12:21:02.938Z", - "displayDate": "8 de Ago de 2022 12:22", - "align": "left", - "type": "application/vnd.lime.media-link+json", - "status": "consumed", - "customerName": "André Rossi", - "id": "c37b66a6-b60f-4bc0-af30-7c9b28874fbd" - } -] \ No newline at end of file + ] + } + ] + } + }, + { + "id": "5", + "to": "553199990000@0mn.io", + "type": "application/vnd.lime.collection+json", + "date": "2022-08-22T12:21:01.938Z", + "displayDate": "08 de Ago de 2022 12:21", + "align": "right", + "status": "consumed", + "content": { + "itemType": "application/vnd.lime.container+json", + "items": [ + { + "type": "application/vnd.lime.media-link+json", + "value": { + "text": "Welcome to our store!", + "type": "image/jpeg", + "uri": "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg" + } + }, + { + "type": "application/vnd.lime.select+json", + "value": { + "text": "Choose what you need", + "options": [ + { "order": 1, "text": "See our stock" }, + { "order": 2, "text": "Follow an order" } + ] + } + }, + { + "type": "application/vnd.lime.media-link+json", + "value": { + "text": "Welcome to our store!", + "type": "video/mp4", + "uri": "https://assets.mixkit.co/videos/preview/mixkit-a-girl-blowing-a-bubble-gum-at-an-amusement-park-1226-large.mp4" + } + }, + { + "type": "application/vnd.lime.media-link+json", + "value": { + "text": "", + "type": "audio/mpeg", + "uri": "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3" + } + }, + { + "type": "application/vnd.lime.media-link+json", + "value": { + "size": 1203179, + "text": "Legenda do pdf", + "title": "teste.pdf", + "type": "application/pdf", + "uri": "https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf" + } + } + ] + } + } +] diff --git a/sample/ios/Podfile.lock b/sample/ios/Podfile.lock index 9ee042ed..7d7ce7bf 100644 --- a/sample/ios/Podfile.lock +++ b/sample/ios/Podfile.lock @@ -70,4 +70,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/sample/lib/main.dart b/sample/lib/main.dart index 4da455a0..3a030982 100644 --- a/sample/lib/main.dart +++ b/sample/lib/main.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:get/route_manager.dart'; import 'package:sample/widgets/showcase/sample_bottom_sheet.showcase.dart'; import 'package:sample/widgets/showcase/sample_button.showcase.dart'; +import 'package:sample/widgets/showcase/sample_collection.showcase.dart'; import 'package:sample/widgets/showcase/sample_dialog.showcase.dart'; import 'package:sample/widgets/showcase/sample_group_card.showcase.dart'; import 'package:sample/widgets/showcase/sample_header.showcase.dart'; @@ -72,6 +73,8 @@ class HomePage extends StatelessWidget { const SampleBottomSheethowcase(), const Divider(color: DSColors.neutralDarkCity), const SampleTicketMessage(), + const Divider(color: DSColors.neutralDarkCity), + const SampleCollectionShowcase(), ], ), ), diff --git a/sample/lib/widgets/showcase/sample_bottom_sheet.showcase.dart b/sample/lib/widgets/showcase/sample_bottom_sheet.showcase.dart index e7808b96..38538f58 100644 --- a/sample/lib/widgets/showcase/sample_bottom_sheet.showcase.dart +++ b/sample/lib/widgets/showcase/sample_bottom_sheet.showcase.dart @@ -59,7 +59,9 @@ class SampleBottomSheethowcase extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ DSPrimaryButton( - onPressed: () => bottomSheetDraggable.showDraggable(), + onPressed: () => bottomSheetDraggable + .showDraggable() + .whenComplete(() => debugPrint('closed')), label: 'resizable bottomsheet', ), ], diff --git a/sample/lib/widgets/showcase/sample_collection.showcase.dart b/sample/lib/widgets/showcase/sample_collection.showcase.dart new file mode 100644 index 00000000..99e6efcd --- /dev/null +++ b/sample/lib/widgets/showcase/sample_collection.showcase.dart @@ -0,0 +1,226 @@ +import 'package:flutter/material.dart'; + +import 'package:blip_ds/blip_ds.dart'; + +class SampleCollectionShowcase extends StatelessWidget { + const SampleCollectionShowcase({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final contentSelect = selectJson['content'] as Map; + final contentContainer = containerJson['content'] as Map; + + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 40.0), + const Center( + child: Text('Collection Carrousel'), + ), + DSCarrousel( + align: DSAlign.left, + content: contentSelect, + borderRadius: const [DSBorderRadius.all], + onOpenLink: (dynamic payload) { + print('Infos de callback: / $payload'); + }, + onSelected: (String text, dynamic payload) { + print('Infos de callback: $text / $payload'); + }, + ), + const SizedBox(height: 40.0), + const Center( + child: Text('Collection Container'), + ), + DSCarrousel( + align: DSAlign.right, + content: contentContainer, + borderRadius: const [DSBorderRadius.all], + onOpenLink: (dynamic payload) { + print('Infos de callback: / $payload'); + }, + onSelected: (String text, dynamic payload) { + print('Infos de callback: $text / $payload'); + }, + ), + ], + ); + } +} + +const selectJson = { + "id": "5", + "to": "1042221589186385@messenger.gw.msging.net", + "type": "application/vnd.lime.collection+json", + "content": { + "itemType": "application/vnd.lime.document-select+json", + "items": [ + { + "header": { + "type": "application/vnd.lime.media-link+json", + "value": { + "title": "Title", + "text": "This is a first item", + "type": "image/jpeg", + "uri": + "http://www.isharearena.com/wp-content/uploads/2012/12/wallpaper-281049.jpg" + } + }, + "options": [ + { + "label": { + "type": "application/vnd.lime.web-link+json", + "value": { + "title": "Link", + "text": "Weblink", + "uri": "https://server.com/first/link1" + } + } + }, + { + "label": {"type": "text/plain", "value": "Text 1"}, + "value": { + "type": "application/json", + "value": {"key1": "value1", "key2": 2} + } + } + ] + }, + { + "header": { + "type": "application/vnd.lime.media-link+json", + "value": { + "title": "Title 2", + "text": "This is another item", + "type": "image/jpeg", + "uri": + "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg" + } + }, + "options": [ + { + "label": { + "type": "application/vnd.lime.web-link+json", + "value": { + "title": "Second link", + "text": "Weblink", + "uri": "https://server.com/second/link2" + } + } + }, + { + "label": {"type": "text/plain", "value": "Second text"}, + "value": { + "type": "application/json", + "value": {"key3": "value3", "key4": 4} + } + }, + { + "label": {"type": "text/plain", "value": "More one text"}, + "value": { + "type": "application/json", + "value": {"key5": "value5", "key6": "6"} + } + } + ] + }, + { + "header": { + "type": "application/vnd.lime.media-link+json", + "value": { + "title": "Title 3", + "text": "This is another item", + "type": "image/jpeg", + "uri": + "http://www.freedigitalphotos.net/images/img/homepage/87357.jpg" + } + }, + "options": [ + { + "label": { + "type": "application/vnd.lime.web-link+json", + "value": { + "title": "Second link", + "text": "Weblink", + "uri": "https://server.com/second/link2" + } + } + }, + { + "label": {"type": "text/plain", "value": "Second text"}, + "value": { + "type": "application/json", + "value": {"key3": "value3", "key4": 4} + } + }, + { + "label": {"type": "text/plain", "value": "More one text"}, + "value": { + "type": "application/json", + "value": {"key5": "value5", "key6": "6"} + } + } + ] + } + ] + } +}; + +const containerJson = { + "id": "5", + "to": "553199990000@0mn.io", + "type": "application/vnd.lime.collection+json", + "content": { + "itemType": "application/vnd.lime.container+json", + "items": [ + { + "type": "application/vnd.lime.media-link+json", + "value": { + "text": "Welcome to our store!", + "type": "image/jpeg", + "uri": + "http://2.bp.blogspot.com/-pATX0YgNSFs/VP-82AQKcuI/AAAAAAAALSU/Vet9e7Qsjjw/s1600/Cat-hd-wallpapers.jpg" + } + }, + { + "type": "application/vnd.lime.select+json", + "value": { + "text": "Choose what you need", + "options": [ + {"order": 1, "text": "See our stock"}, + {"order": 2, "text": "Follow an order"} + ] + } + }, + { + "type": "application/vnd.lime.media-link+json", + "value": { + "text": "Welcome to our store!", + "type": "video/mp4", + "uri": + "https://assets.mixkit.co/videos/preview/mixkit-a-girl-blowing-a-bubble-gum-at-an-amusement-park-1226-large.mp4" + } + }, + { + "type": "application/vnd.lime.media-link+json", + "value": { + "text": "", + "type": "audio/mpeg", + "uri": + "https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3" + } + }, + { + "type": "application/vnd.lime.media-link+json", + "value": { + "size": 1203179, + "text": "Legenda do pdf", + "title": "teste.pdf", + "type": "application/pdf", + "uri": + "https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf" + } + } + ] + } +}; diff --git a/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart b/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart index fb0f1811..b021de2c 100644 --- a/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart +++ b/sample/lib/widgets/showcase/sample_message_bubble.showcase.dart @@ -83,7 +83,7 @@ class SampleMessageBubbleShowcase extends StatelessWidget { ), DSTextMessageBubble( text: - 'Exemplo de preview completo e borda "reta": https://www.take.net/', + 'Exemplo de preview completo e borda "reta": https://www.take.net/ paollalira@outlook.com', align: DSAlign.right, borderRadius: const [ DSBorderRadius.bottomLeft, @@ -118,11 +118,12 @@ class SampleMessageBubbleShowcase extends StatelessWidget { align: DSAlign.right, ), DSFileMessageBubble( - align: DSAlign.left, - filename: 'teste.pdf', - size: 10000, - url: - 'https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf'), + align: DSAlign.left, + filename: 'teste.pdf', + size: 10000, + url: + 'https://download.brother.com/welcome/doc100107/cv_mfc4620dw_epr_busr_leu359065.pdf', + ), DSFileMessageBubble( align: DSAlign.right, filename: 'master.zip', diff --git a/sample/pubspec.lock b/sample/pubspec.lock index 40cc43d9..0c4a19d7 100644 --- a/sample/pubspec.lock +++ b/sample/pubspec.lock @@ -21,7 +21,7 @@ packages: path: ".." relative: true source: path - version: "0.0.15" + version: "0.0.16" boolean_selector: dependency: transitive description: @@ -490,6 +490,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.10.0" + sticky_headers: + dependency: transitive + description: + name: sticky_headers + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0+2" stream_channel: dependency: transitive description: diff --git a/sample/test/sample_test.dart b/sample/test/sample_test.dart deleted file mode 100644 index f959ca10..00000000 --- a/sample/test/sample_test.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; - -void main() { - test('test', () {}); -} diff --git a/test/blip_ds_test.dart b/test/blip_ds_test.dart deleted file mode 100644 index f959ca10..00000000 --- a/test/blip_ds_test.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; - -void main() { - test('test', () {}); -} diff --git a/test/extensions/ds_widget_tester.extension.dart b/test/extensions/ds_widget_tester.extension.dart new file mode 100644 index 00000000..9d919c7d --- /dev/null +++ b/test/extensions/ds_widget_tester.extension.dart @@ -0,0 +1,49 @@ +import 'package:blip_ds/src/utils/ds_utils.util.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +extension DSWidgetTesterExtension on WidgetTester { + Future screenMatchesGoldenSteps( + final String name, { + final int additionalSteps = 0, + final Duration pumpInitialDuration = Duration.zero, + final Duration pumpTotalDuration = DSUtils.defaultAnimationDuration, + }) async { + if (pumpInitialDuration > pumpTotalDuration) { + throw Exception( + 'The initial duration shouldn\'t be lower than the total duration.\n' + '- Initial Duration: $pumpInitialDuration\n' + '- Total Duration: $pumpTotalDuration', + ); + } + + int currentDuration = pumpInitialDuration.inMilliseconds; + final int totalDuration = pumpTotalDuration.inMilliseconds; + + late final int stepDuration; + + if (additionalSteps > 0) { + stepDuration = (totalDuration / (additionalSteps + 1)).floor(); + } else { + stepDuration = totalDuration - currentDuration; + } + + int stepCount = 0; + + while (currentDuration <= totalDuration) { + await screenMatchesGolden( + this, + '${name}_step_$stepCount', + autoHeight: true, + customPump: (customTester) async { + await customTester.pump( + Duration(milliseconds: currentDuration), + ); + }, + ); + + currentDuration += stepDuration; + stepCount++; + } + } +} diff --git a/test/flutter_test_config.dart b/test/flutter_test_config.dart new file mode 100644 index 00000000..31cf4707 --- /dev/null +++ b/test/flutter_test_config.dart @@ -0,0 +1,8 @@ +import 'dart:async'; + +import 'package:golden_toolkit/golden_toolkit.dart'; + +Future testExecutable(FutureOr Function() testMain) async { + await loadAppFonts(); + return testMain(); +} diff --git a/test/widgets/animations/ds_animation_test.util.dart b/test/widgets/animations/ds_animation_test.util.dart new file mode 100644 index 00000000..2aeb7493 --- /dev/null +++ b/test/widgets/animations/ds_animation_test.util.dart @@ -0,0 +1,106 @@ +import 'package:blip_ds/src/themes/colors/ds_colors.theme.dart'; +import 'package:blip_ds/src/widgets/animations/ds_fading_circle_loading.widget.dart'; +import 'package:blip_ds/src/widgets/animations/ds_ring_loading.widget.dart'; +import 'package:flutter/material.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +import 'mocks/ds_animated_size.mock.dart'; + +class DSAnimationTestUtils { + static const animatedSizeGoldenPath = 'ds_animated_size/ds_animated_size'; + static const ringLoadingGoldenPath = 'ds_ring_loading/ds_ring_loading'; + static const fadingCircleLoadingGoldenPath = + 'ds_fading_circle_loading/ds_fading_circle_loading'; + + static GoldenBuilder createAnimatedSizeScenarios() { + final builder = GoldenBuilder.column(); + + builder.addScenario( + 'DSAnimatedSize - Size 10 to 30', + buildAnimatedSize( + width: 10.0, + height: 10.0, + ), + ); + + return builder; + } + + static GoldenBuilder createRingLoadingScenarios() { + final builder = GoldenBuilder.column(); + + builder.addScenario( + 'DSRingLoading - Blue, Size 24, Line 2', + buildRingLoading( + color: DSColors.primaryNight, + size: 24.0, + lineWidth: 2.0, + ), + ); + + builder.addScenario( + 'DSRingLoading - Red, Size 48, Line 4', + buildRingLoading( + color: DSColors.extendRedsDragon, + size: 48.0, + lineWidth: 5.0, + ), + ); + + return builder; + } + + static GoldenBuilder createFadingCircleLoadingScenarios() { + final builder = GoldenBuilder.column(); + + builder.addScenario( + 'DSFadingCircle - Blue, Size 24', + buildFadingCircleLoading( + color: DSColors.primaryNight, + size: 24.0, + ), + ); + + builder.addScenario( + 'DSFadingCircle - Red, Size 48', + buildFadingCircleLoading( + color: DSColors.extendRedsDragon, + size: 48.0, + ), + ); + + return builder; + } + + static MockDSAnimatedSize buildAnimatedSize({ + required final double width, + required final double height, + }) { + return MockDSAnimatedSize( + initWidth: width, + initHeight: height, + ); + } + + static DSRingLoading buildRingLoading({ + final Color color = DSColors.primaryNight, + final double size = 24.0, + final double lineWidth = 2.0, + }) { + return DSRingLoading( + color: color, + size: size, + lineWidth: lineWidth, + ); + } + + static DSFadingCircleLoading buildFadingCircleLoading({ + final Color color = DSColors.primaryNight, + final double size = 24.0, + }) { + return DSFadingCircleLoading( + color: color, + size: size, + ); + } +} diff --git a/test/widgets/animations/ds_animations_test.dart b/test/widgets/animations/ds_animations_test.dart new file mode 100644 index 00000000..b8ae4707 --- /dev/null +++ b/test/widgets/animations/ds_animations_test.dart @@ -0,0 +1,69 @@ +import 'package:blip_ds/blip_ds.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +import '../../extensions/ds_widget_tester.extension.dart'; +import 'ds_animation_test.util.dart'; + +void main() { + group( + 'Animated Size', + () { + testGoldens( + 'Animated size should match golden image', + (tester) async { + final builder = DSAnimationTestUtils.createAnimatedSizeScenarios(); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.tap(find.byType(DSAnimatedSize)); + + await tester.screenMatchesGoldenSteps( + DSAnimationTestUtils.animatedSizeGoldenPath, + additionalSteps: 2, + pumpTotalDuration: const Duration(milliseconds: 60), + ); + }, + ); + }, + ); + + group( + 'Ring Loading', + () { + testGoldens( + 'Ring loading should match golden image', + (tester) async { + final builder = DSAnimationTestUtils.createRingLoadingScenarios(); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + DSAnimationTestUtils.ringLoadingGoldenPath, + additionalSteps: 2, + ); + }, + ); + }, + ); + + group( + 'Fading Circle Loading', + () { + testGoldens( + 'Fading circle loading should match golden image', + (tester) async { + final builder = + DSAnimationTestUtils.createFadingCircleLoadingScenarios(); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + DSAnimationTestUtils.fadingCircleLoadingGoldenPath, + additionalSteps: 2, + ); + }, + ); + }, + ); +} diff --git a/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_0.png b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_0.png new file mode 100644 index 00000000..d8a39de7 Binary files /dev/null and b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_0.png differ diff --git a/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_1.png b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_1.png new file mode 100644 index 00000000..a3ef636c Binary files /dev/null and b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_1.png differ diff --git a/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_2.png b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_2.png new file mode 100644 index 00000000..fcf80708 Binary files /dev/null and b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_2.png differ diff --git a/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_3.png b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_3.png new file mode 100644 index 00000000..b6615f63 Binary files /dev/null and b/test/widgets/animations/goldens/ds_animated_size/ds_animated_size_step_3.png differ diff --git a/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_0.png b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_0.png new file mode 100644 index 00000000..2629a6ae Binary files /dev/null and b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_0.png differ diff --git a/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_1.png b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_1.png new file mode 100644 index 00000000..194ece0d Binary files /dev/null and b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_1.png differ diff --git a/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_2.png b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_2.png new file mode 100644 index 00000000..f877f472 Binary files /dev/null and b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_2.png differ diff --git a/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_3.png b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_3.png new file mode 100644 index 00000000..18cb442d Binary files /dev/null and b/test/widgets/animations/goldens/ds_fading_circle_loading/ds_fading_circle_loading_step_3.png differ diff --git a/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_0.png b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_0.png new file mode 100644 index 00000000..11a950e7 Binary files /dev/null and b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_0.png differ diff --git a/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_1.png b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_1.png new file mode 100644 index 00000000..1cbc51f3 Binary files /dev/null and b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_1.png differ diff --git a/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_2.png b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_2.png new file mode 100644 index 00000000..f121c985 Binary files /dev/null and b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_2.png differ diff --git a/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_3.png b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_3.png new file mode 100644 index 00000000..d8da1399 Binary files /dev/null and b/test/widgets/animations/goldens/ds_ring_loading/ds_ring_loading_step_3.png differ diff --git a/test/widgets/animations/mocks/ds_animated_size.mock.dart b/test/widgets/animations/mocks/ds_animated_size.mock.dart new file mode 100644 index 00000000..80c6655a --- /dev/null +++ b/test/widgets/animations/mocks/ds_animated_size.mock.dart @@ -0,0 +1,41 @@ +import 'package:blip_ds/src/themes/colors/ds_colors.theme.dart'; +import 'package:blip_ds/src/widgets/animations/ds_animated_size.widget.dart'; +import 'package:flutter/material.dart'; + +class MockDSAnimatedSize extends StatefulWidget { + final double initWidth; + final double initHeight; + + const MockDSAnimatedSize({ + super.key, + required this.initWidth, + required this.initHeight, + }); + + @override + State createState() => _MockDSAnimatedSizeState(); +} + +class _MockDSAnimatedSizeState extends State { + double? currentWidth; + double? currentHeight; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + setState(() { + currentWidth = widget.initWidth * 30; + currentHeight = widget.initHeight * 30; + }); + }, + child: DSAnimatedSize( + child: Container( + width: currentWidth ?? widget.initWidth, + height: currentHeight ?? widget.initHeight, + color: DSColors.extendRedsDragon, + ), + ), + ); + } +} diff --git a/test/widgets/buttons/ds_buttons_test.dart b/test/widgets/buttons/ds_buttons_test.dart new file mode 100644 index 00000000..b6524389 --- /dev/null +++ b/test/widgets/buttons/ds_buttons_test.dart @@ -0,0 +1,792 @@ +import 'package:blip_ds/blip_ds.dart'; +import 'package:blip_ds/src/widgets/buttons/ds_pause_button.widget.dart'; +import 'package:blip_ds/src/widgets/buttons/ds_play_button.widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +import '../../extensions/ds_widget_tester.extension.dart'; +import 'ds_buttons_test.util.dart'; + +void main() { + group( + 'Standard Button', + () { + testGoldens( + 'Standard button should match golden image when is enabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSButton', + 'Enabled', + buttonBuilder: DSButtonsTestUtils.buildStandardButton, + isEnabled: true, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.enabledStandardButtonGoldenPath}/ds_button_enabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Standard button should match golden image when is disabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSButton', + 'Disabled', + buttonBuilder: DSButtonsTestUtils.buildStandardButton, + isEnabled: false, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.disabledStandardButtonGoldenPath}/ds_button_disabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Standard button should match golden image when is enabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSButton', + 'Enabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildStandardButton, + isEnabled: true, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.enabledStandardButtonGoldenPath}/loading/ds_button_enabled_loading', + additionalSteps: 2, + ); + }, + ); + + testGoldens( + 'Standard button should match golden image when is disabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSButton', + 'Disabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildStandardButton, + isEnabled: false, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.disabledStandardButtonGoldenPath}/loading/ds_button_disabled_loading', + additionalSteps: 2, + ); + }, + ); + + testWidgets( + 'Standard button should be tapped and return true', + (tester) async { + bool wasTapped = false; + + final DSButton button = DSButtonsTestUtils.buildStandardButton( + onPressed: () => wasTapped = true, + ); + + await tester.pumpWidgetBuilder(button); + + expect(wasTapped, false); + + await tester.tap( + find.byWidget(button), + ); + + expect(wasTapped, true); + }, + ); + + testWidgets( + 'Standard button should be disabled', + (tester) async { + const Key keyButton1 = Key('button-1'); + const Key keyButton2 = Key('button-2'); + const Key keyButton3 = Key('button-3'); + const Key keyButton4 = Key('button-4'); + + int counter = 0; + incrementCounter() => counter++; + + final Widget buttons = Column( + children: [ + DSButtonsTestUtils.buildStandardButton( + key: keyButton1, + onPressed: null, + isEnabled: false, + ), + DSButtonsTestUtils.buildStandardButton( + key: keyButton2, + onPressed: null, + isEnabled: true, + ), + DSButtonsTestUtils.buildStandardButton( + key: keyButton3, + onPressed: incrementCounter, + isEnabled: false, + ), + DSButtonsTestUtils.buildStandardButton( + key: keyButton4, + onPressed: incrementCounter, + isEnabled: true, + ), + ], + ); + + await tester.pumpWidgetBuilder(buttons); + + final Finder findButton1 = find.byKey(keyButton1); + final Finder findButton2 = find.byKey(keyButton2); + final Finder findButton3 = find.byKey(keyButton3); + final Finder findButton4 = find.byKey(keyButton4); + + await tester.tap(findButton1); + await tester.tap(findButton2); + await tester.tap(findButton3); + + expect(counter, 0); + + await tester.tap(findButton4); + + expect(counter, 1); + }, + ); + }, + ); + + group( + 'Primary Button', + () { + testGoldens( + 'Primary button should match golden image when is enabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSPrimaryButton', + 'Enabled', + buttonBuilder: DSButtonsTestUtils.buildPrimaryButton, + isEnabled: true, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.enabledPrimaryButtonGoldenPath}/ds_primary_button_enabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Primary button should match golden image when is disabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSPrimaryButton', + 'Disabled', + buttonBuilder: DSButtonsTestUtils.buildPrimaryButton, + isEnabled: false, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.disabledPrimaryButtonGoldenPath}/ds_primary_button_disabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Primary button should match golden image when is enabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSPrimaryButton', + 'Enabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildPrimaryButton, + isEnabled: true, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.enabledPrimaryButtonGoldenPath}/loading/ds_primary_button_enabled_loading', + additionalSteps: 2, + ); + }, + ); + + testGoldens( + 'Primary button should match golden image when is disabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSPrimaryButton', + 'Disabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildPrimaryButton, + isEnabled: false, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.disabledPrimaryButtonGoldenPath}/loading/ds_primary_button_disabled_loading', + additionalSteps: 2, + ); + }, + ); + + testWidgets( + 'Primary button should be a standard button subclass', + (tester) async { + final DSPrimaryButton button = DSButtonsTestUtils.buildPrimaryButton( + onPressed: () {}, + ); + + await tester.pumpWidgetBuilder(button); + + final Finder findButton = find.bySubtype(); + + expect(findButton, findsOneWidget); + }, + ); + + testWidgets( + 'Primary button should be tapped and return true', + (tester) async { + bool wasTapped = false; + + final DSButton button = DSButtonsTestUtils.buildPrimaryButton( + onPressed: () => wasTapped = true, + ); + + await tester.pumpWidgetBuilder(button); + + expect(wasTapped, false); + + await tester.tap( + find.byWidget(button), + ); + + expect(wasTapped, true); + }, + ); + + testWidgets( + 'Primary button should be disabled', + (tester) async { + const Key keyButton1 = Key('button-1'); + const Key keyButton2 = Key('button-2'); + const Key keyButton3 = Key('button-3'); + const Key keyButton4 = Key('button-4'); + + int counter = 0; + incrementCounter() => counter++; + + final Widget buttons = Column( + children: [ + DSButtonsTestUtils.buildPrimaryButton( + key: keyButton1, + onPressed: null, + isEnabled: false, + ), + DSButtonsTestUtils.buildPrimaryButton( + key: keyButton2, + onPressed: null, + isEnabled: true, + ), + DSButtonsTestUtils.buildPrimaryButton( + key: keyButton3, + onPressed: incrementCounter, + isEnabled: false, + ), + DSButtonsTestUtils.buildPrimaryButton( + key: keyButton4, + onPressed: incrementCounter, + isEnabled: true, + ), + ], + ); + + await tester.pumpWidgetBuilder(buttons); + + final Finder findButton1 = find.byKey(keyButton1); + final Finder findButton2 = find.byKey(keyButton2); + final Finder findButton3 = find.byKey(keyButton3); + final Finder findButton4 = find.byKey(keyButton4); + + await tester.tap(findButton1); + await tester.tap(findButton2); + await tester.tap(findButton3); + + expect(counter, 0); + + await tester.tap(findButton4); + + expect(counter, 1); + }, + ); + }, + ); + + group( + 'Secondary Button', + () { + testGoldens( + 'Secondary button should match golden image when is enabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSSecondaryButton', + 'Enabled', + buttonBuilder: DSButtonsTestUtils.buildSecondaryButton, + isEnabled: true, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.enabledSecondaryButtonGoldenPath}/ds_secondary_button_enabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Secondary button should match golden image when is disabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSSecondaryButton', + 'Disabled', + buttonBuilder: DSButtonsTestUtils.buildSecondaryButton, + isEnabled: false, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.disabledSecondaryButtonGoldenPath}/ds_secondary_button_disabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Secondary button should match golden image when is enabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSSecondaryButton', + 'Enabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildSecondaryButton, + isEnabled: true, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.enabledSecondaryButtonGoldenPath}/loading/ds_secondary_button_enabled_loading', + additionalSteps: 2, + ); + }, + ); + + testGoldens( + 'Secondary button should match golden image when is disabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSSecondaryButton', + 'Disabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildSecondaryButton, + isEnabled: false, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.disabledSecondaryButtonGoldenPath}/loading/ds_secondary_button_disabled_loading', + additionalSteps: 2, + ); + }, + ); + + testWidgets( + 'Secondary button should be a standard button subclass', + (tester) async { + final DSSecondaryButton button = + DSButtonsTestUtils.buildSecondaryButton( + onPressed: () {}, + ); + + await tester.pumpWidgetBuilder(button); + + final Finder findButton = find.bySubtype(); + + expect(findButton, findsOneWidget); + }, + ); + + testWidgets( + 'Secondary button should be tapped and return true', + (tester) async { + bool wasTapped = false; + + final DSButton button = DSButtonsTestUtils.buildSecondaryButton( + onPressed: () => wasTapped = true, + ); + + await tester.pumpWidgetBuilder(button); + + expect(wasTapped, false); + + await tester.tap( + find.byWidget(button), + ); + + expect(wasTapped, true); + }, + ); + + testWidgets( + 'Secondary button should be disabled', + (tester) async { + const Key keyButton1 = Key('button-1'); + const Key keyButton2 = Key('button-2'); + const Key keyButton3 = Key('button-3'); + const Key keyButton4 = Key('button-4'); + + int counter = 0; + incrementCounter() => counter++; + + final Widget buttons = Column( + children: [ + DSButtonsTestUtils.buildSecondaryButton( + key: keyButton1, + onPressed: null, + isEnabled: false, + ), + DSButtonsTestUtils.buildSecondaryButton( + key: keyButton2, + onPressed: null, + isEnabled: true, + ), + DSButtonsTestUtils.buildSecondaryButton( + key: keyButton3, + onPressed: incrementCounter, + isEnabled: false, + ), + DSButtonsTestUtils.buildSecondaryButton( + key: keyButton4, + onPressed: incrementCounter, + isEnabled: true, + ), + ], + ); + + await tester.pumpWidgetBuilder(buttons); + + final Finder findButton1 = find.byKey(keyButton1); + final Finder findButton2 = find.byKey(keyButton2); + final Finder findButton3 = find.byKey(keyButton3); + final Finder findButton4 = find.byKey(keyButton4); + + await tester.tap(findButton1); + await tester.tap(findButton2); + await tester.tap(findButton3); + + expect(counter, 0); + + await tester.tap(findButton4); + + expect(counter, 1); + }, + ); + }, + ); + + group( + 'Tertiary Button', + () { + testGoldens( + 'Tertiary button should match golden image when is enabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSTertiaryButton', + 'Enabled', + buttonBuilder: DSButtonsTestUtils.buildTertiaryButton, + isEnabled: true, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.enabledTertiaryButtonGoldenPath}/ds_tertiary_button_enabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Tertiary button should match golden image when is disabled', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSTertiaryButton', + 'Disabled', + buttonBuilder: DSButtonsTestUtils.buildTertiaryButton, + isEnabled: false, + isLoading: false, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.disabledTertiaryButtonGoldenPath}/ds_tertiary_button_disabled', + autoHeight: true, + ); + }, + ); + + testGoldens( + 'Tertiary button should match golden image when is enabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSTertiaryButton', + 'Enabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildTertiaryButton, + isEnabled: true, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.enabledTertiaryButtonGoldenPath}/loading/ds_tertiary_button_enabled_loading', + additionalSteps: 2, + ); + }, + ); + + testGoldens( + 'Tertiary button should match golden image when is disabled and loading', + (tester) async { + final builder = DSButtonsTestUtils.createButtonScenarios( + 'DSTertiaryButton', + 'Disabled + Loading', + buttonBuilder: DSButtonsTestUtils.buildTertiaryButton, + isEnabled: false, + isLoading: true, + ); + + await tester.pumpWidgetBuilder(builder.build()); + + await tester.screenMatchesGoldenSteps( + '${DSButtonsTestUtils.disabledTertiaryButtonGoldenPath}/loading/ds_tertiary_button_disabled_loading', + additionalSteps: 2, + ); + }, + ); + + testWidgets( + 'Tertiary button should be a standard button subclass', + (tester) async { + final DSTertiaryButton button = + DSButtonsTestUtils.buildTertiaryButton( + onPressed: () {}, + ); + + await tester.pumpWidgetBuilder(button); + + final Finder findButton = find.bySubtype(); + + expect(findButton, findsOneWidget); + }, + ); + + testWidgets( + 'Tertiary button should be tapped and return true', + (tester) async { + bool wasTapped = false; + + final DSButton button = DSButtonsTestUtils.buildTertiaryButton( + onPressed: () => wasTapped = true, + ); + + await tester.pumpWidgetBuilder(button); + + expect(wasTapped, false); + + await tester.tap( + find.byWidget(button), + ); + + expect(wasTapped, true); + }, + ); + + testWidgets( + 'Tertiary button should be disabled', + (tester) async { + const Key keyButton1 = Key('button-1'); + const Key keyButton2 = Key('button-2'); + const Key keyButton3 = Key('button-3'); + const Key keyButton4 = Key('button-4'); + + int counter = 0; + incrementCounter() => counter++; + + final Widget buttons = Column( + children: [ + DSButtonsTestUtils.buildTertiaryButton( + key: keyButton1, + onPressed: null, + isEnabled: false, + ), + DSButtonsTestUtils.buildTertiaryButton( + key: keyButton2, + onPressed: null, + isEnabled: true, + ), + DSButtonsTestUtils.buildTertiaryButton( + key: keyButton3, + onPressed: incrementCounter, + isEnabled: false, + ), + DSButtonsTestUtils.buildTertiaryButton( + key: keyButton4, + onPressed: incrementCounter, + isEnabled: true, + ), + ], + ); + + await tester.pumpWidgetBuilder(buttons); + + final Finder findButton1 = find.byKey(keyButton1); + final Finder findButton2 = find.byKey(keyButton2); + final Finder findButton3 = find.byKey(keyButton3); + final Finder findButton4 = find.byKey(keyButton4); + + await tester.tap(findButton1); + await tester.tap(findButton2); + await tester.tap(findButton3); + + expect(counter, 0); + + await tester.tap(findButton4); + + expect(counter, 1); + }, + ); + }, + ); + + group( + 'Play Button', + () { + testGoldens( + 'Play button should match golden image', + (tester) async { + final builder = DSButtonsTestUtils.createPlayButtonScenarios(); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.playButtonGoldenPath}/ds_play_button', + autoHeight: true, + ); + }, + ); + + testWidgets( + 'Play button should be tapped and return true', + (tester) async { + bool wasTapped = false; + + final DSPlayButton button = DSButtonsTestUtils.buildPlayButton( + onPressed: () => wasTapped = true, + ); + + await tester.pumpWidgetBuilder(button); + + expect(wasTapped, false); + + await tester.tap( + find.byWidget(button), + ); + + expect(wasTapped, true); + }, + ); + }, + ); + + group( + 'Pause Button', + () { + testGoldens( + 'Pause button should match golden image', + (tester) async { + final builder = DSButtonsTestUtils.createPauseButtonScenarios(); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + '${DSButtonsTestUtils.pauseButtonGoldenPath}/ds_pause_button', + autoHeight: true, + ); + }, + ); + + testWidgets( + 'Pause button should be tapped and return true', + (tester) async { + bool wasTapped = false; + + final DSPauseButton button = DSButtonsTestUtils.buildPauseButton( + onPressed: () => wasTapped = true, + ); + + await tester.pumpWidgetBuilder(button); + + expect(wasTapped, false); + + final Finder findButton = find.byWidget(button); + + await tester.tap(findButton); + + expect(wasTapped, true); + }, + ); + }, + ); +} diff --git a/test/widgets/buttons/ds_buttons_test.util.dart b/test/widgets/buttons/ds_buttons_test.util.dart new file mode 100644 index 00000000..edde5a7f --- /dev/null +++ b/test/widgets/buttons/ds_buttons_test.util.dart @@ -0,0 +1,295 @@ +import 'package:blip_ds/blip_ds.dart'; +import 'package:blip_ds/src/widgets/buttons/ds_pause_button.widget.dart'; +import 'package:blip_ds/src/widgets/buttons/ds_play_button.widget.dart'; +import 'package:flutter/material.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +typedef ButtonBuilderFunction = DSButton Function({ + required void Function()? onPressed, + bool isEnabled, + Icon? leadingIcon, + String? label, + Icon? trailingIcon, + bool isLoading, +}); + +class DSButtonsTestUtils { + static const String enabledStandardButtonGoldenPath = 'ds_button/enabled'; + static const String disabledStandardButtonGoldenPath = 'ds_button/disabled'; + + static const String enabledPrimaryButtonGoldenPath = + 'ds_primary_button/enabled'; + static const String disabledPrimaryButtonGoldenPath = + 'ds_primary_button/disabled'; + + static const String enabledSecondaryButtonGoldenPath = + 'ds_secondary_button/enabled'; + static const String disabledSecondaryButtonGoldenPath = + 'ds_secondary_button/disabled'; + + static const String enabledTertiaryButtonGoldenPath = + 'ds_tertiary_button/enabled'; + static const String disabledTertiaryButtonGoldenPath = + 'ds_tertiary_button/disabled'; + + static const String playButtonGoldenPath = 'ds_play_button'; + static const String pauseButtonGoldenPath = 'ds_pause_button'; + + static GoldenBuilder createButtonScenarios( + final String buttonName, + final String description, { + required final ButtonBuilderFunction buttonBuilder, + required final bool isEnabled, + required final bool isLoading, + }) { + const leadingIcon = Icon(Icons.search); + const trailingIcon = Icon(Icons.access_alarm); + const label = 'Click Here'; + + final builder = GoldenBuilder.grid( + columns: 3, + widthToHeightRatio: 1, + ); + + if (isLoading) { + builder.addScenario( + '$buttonName - ($description) Loading', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + isLoading: isLoading, + trailingIcon: trailingIcon, + leadingIcon: leadingIcon, + label: label, + ), + ); + } else { + builder.addScenario( + '$buttonName - ($description) Blank', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + ), + ); + + builder.addScenario( + '$buttonName - ($description) Leading Icon Only', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + leadingIcon: leadingIcon, + ), + ); + + builder.addScenario( + '$buttonName - ($description) Trailing Icon Only', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + trailingIcon: trailingIcon, + ), + ); + + builder.addScenario( + '$buttonName - ($description) Label Only', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + label: label, + ), + ); + + builder.addScenario( + '$buttonName - ($description) Label + Trailing Icon', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + trailingIcon: trailingIcon, + label: label, + ), + ); + + builder.addScenario( + '$buttonName - ($description) Leading Icon + Label', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + leadingIcon: leadingIcon, + label: label, + ), + ); + + builder.addScenario( + '$buttonName - ($description) Leading Icon + Trailing Icon', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + trailingIcon: trailingIcon, + leadingIcon: leadingIcon, + ), + ); + + builder.addScenario( + '$buttonName - ($description) Leading Icon + Label + Trailing Icon', + buttonBuilder.call( + onPressed: () {}, + isEnabled: isEnabled, + trailingIcon: trailingIcon, + leadingIcon: leadingIcon, + label: label, + ), + ); + } + + return builder; + } + + static GoldenBuilder createPlayButtonScenarios() { + final builder = GoldenBuilder.column(); + + builder.addScenario( + 'Neutral Light Snow Color', + buildPlayButton( + onPressed: () {}, + iconColor: DSPlayButtonIconColor.neutralLightSnow, + ), + ); + + builder.addScenario( + 'Neutral Dark Rooftop Color', + buildPlayButton( + onPressed: () {}, + iconColor: DSPlayButtonIconColor.neutralDarkRooftop, + ), + ); + + return builder; + } + + static GoldenBuilder createPauseButtonScenarios() { + final builder = GoldenBuilder.column(); + + builder.addScenario( + 'Primary Greens True Color', + buildPauseButton( + onPressed: () {}, + color: DSColors.primaryGreensTrue, + ), + ); + + builder.addScenario( + 'Extend Reds Lipstick Color', + buildPauseButton( + onPressed: () {}, + color: DSColors.extendRedsLipstick, + ), + ); + + return builder; + } + + static DSButton buildStandardButton({ + required final void Function()? onPressed, + final Key? key, + final bool isEnabled = true, + final Icon? leadingIcon, + final String? label, + final Icon? trailingIcon, + final bool isLoading = false, + }) { + return DSButton( + key: key, + onPressed: onPressed, + backgroundColor: isEnabled ? DSColors.primaryNight : DSColors.disabledBg, + foregroundColor: isEnabled + ? DSColors.neutralLightSnow + : DSColors.neutralMediumElephant, + isEnabled: isEnabled, + leadingIcon: leadingIcon, + label: label, + trailingIcon: trailingIcon, + isLoading: isLoading, + ); + } + + static DSPrimaryButton buildPrimaryButton({ + required final void Function()? onPressed, + final Key? key, + final Icon? leadingIcon, + final String? label, + final Icon? trailingIcon, + final bool isEnabled = true, + final bool isLoading = false, + }) { + return DSPrimaryButton( + key: key, + onPressed: onPressed, + isEnabled: isEnabled, + isLoading: isLoading, + leadingIcon: leadingIcon, + label: label, + trailingIcon: trailingIcon, + ); + } + + static DSSecondaryButton buildSecondaryButton({ + required final void Function()? onPressed, + final Key? key, + final Icon? leadingIcon, + final String? label, + final Icon? trailingIcon, + final bool isEnabled = true, + final bool isLoading = false, + }) { + return DSSecondaryButton( + key: key, + onPressed: onPressed, + isEnabled: isEnabled, + isLoading: isLoading, + leadingIcon: leadingIcon, + label: label, + trailingIcon: trailingIcon, + ); + } + + static DSTertiaryButton buildTertiaryButton({ + required final void Function()? onPressed, + final Key? key, + final Icon? leadingIcon, + final String? label, + final Icon? trailingIcon, + final bool isEnabled = true, + final bool isLoading = false, + }) { + return DSTertiaryButton( + key: key, + onPressed: onPressed, + isEnabled: isEnabled, + isLoading: isLoading, + leadingIcon: leadingIcon, + label: label, + trailingIcon: trailingIcon, + ); + } + + static DSPlayButton buildPlayButton({ + required final void Function() onPressed, + final DSPlayButtonIconColor iconColor = + DSPlayButtonIconColor.neutralDarkRooftop, + }) { + return DSPlayButton( + icon: iconColor, + onPressed: onPressed, + ); + } + + static DSPauseButton buildPauseButton({ + required final void Function() onPressed, + final Color color = DSColors.primaryNight, + }) { + return DSPauseButton( + onPressed: onPressed, + color: color, + ); + } +} diff --git a/test/widgets/buttons/goldens/ds_button/disabled/ds_button_disabled.png b/test/widgets/buttons/goldens/ds_button/disabled/ds_button_disabled.png new file mode 100644 index 00000000..07c719d5 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/disabled/ds_button_disabled.png differ diff --git a/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_0.png new file mode 100644 index 00000000..710655d6 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_1.png new file mode 100644 index 00000000..8ed42e6f Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_2.png new file mode 100644 index 00000000..f4b7e828 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_3.png new file mode 100644 index 00000000..d08d5cd8 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/disabled/loading/ds_button_disabled_loading_step_3.png differ diff --git a/test/widgets/buttons/goldens/ds_button/enabled/ds_button_enabled.png b/test/widgets/buttons/goldens/ds_button/enabled/ds_button_enabled.png new file mode 100644 index 00000000..4beef8fe Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/enabled/ds_button_enabled.png differ diff --git a/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_0.png new file mode 100644 index 00000000..15e0c5ce Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_1.png new file mode 100644 index 00000000..a2442404 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_2.png new file mode 100644 index 00000000..443d09eb Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_3.png new file mode 100644 index 00000000..8ab1e50a Binary files /dev/null and b/test/widgets/buttons/goldens/ds_button/enabled/loading/ds_button_enabled_loading_step_3.png differ diff --git a/test/widgets/buttons/goldens/ds_pause_button/ds_pause_button.png b/test/widgets/buttons/goldens/ds_pause_button/ds_pause_button.png new file mode 100644 index 00000000..fd9d6b0e Binary files /dev/null and b/test/widgets/buttons/goldens/ds_pause_button/ds_pause_button.png differ diff --git a/test/widgets/buttons/goldens/ds_play_button/ds_play_button.png b/test/widgets/buttons/goldens/ds_play_button/ds_play_button.png new file mode 100644 index 00000000..468c9b22 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_play_button/ds_play_button.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/disabled/ds_primary_button_disabled.png b/test/widgets/buttons/goldens/ds_primary_button/disabled/ds_primary_button_disabled.png new file mode 100644 index 00000000..faeb2457 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/disabled/ds_primary_button_disabled.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_0.png new file mode 100644 index 00000000..d54af66d Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_1.png new file mode 100644 index 00000000..813b7bcb Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_2.png new file mode 100644 index 00000000..a31f90cb Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_3.png new file mode 100644 index 00000000..cbca5b9e Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/disabled/loading/ds_primary_button_disabled_loading_step_3.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/enabled/ds_primary_button_enabled.png b/test/widgets/buttons/goldens/ds_primary_button/enabled/ds_primary_button_enabled.png new file mode 100644 index 00000000..f04ab034 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/enabled/ds_primary_button_enabled.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_0.png new file mode 100644 index 00000000..0821d9da Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_1.png new file mode 100644 index 00000000..e3093634 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_2.png new file mode 100644 index 00000000..fade8414 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_3.png new file mode 100644 index 00000000..26d03695 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_primary_button/enabled/loading/ds_primary_button_enabled_loading_step_3.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/disabled/ds_secondary_button_disabled.png b/test/widgets/buttons/goldens/ds_secondary_button/disabled/ds_secondary_button_disabled.png new file mode 100644 index 00000000..be390114 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/disabled/ds_secondary_button_disabled.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_0.png new file mode 100644 index 00000000..5f6785b0 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_1.png new file mode 100644 index 00000000..cf660e14 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_2.png new file mode 100644 index 00000000..7d532f09 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_3.png new file mode 100644 index 00000000..368267b6 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/disabled/loading/ds_secondary_button_disabled_loading_step_3.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/enabled/ds_secondary_button_enabled.png b/test/widgets/buttons/goldens/ds_secondary_button/enabled/ds_secondary_button_enabled.png new file mode 100644 index 00000000..19bfa615 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/enabled/ds_secondary_button_enabled.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_0.png new file mode 100644 index 00000000..222452aa Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_1.png new file mode 100644 index 00000000..00398016 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_2.png new file mode 100644 index 00000000..a635e69d Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_3.png new file mode 100644 index 00000000..6b243f56 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_secondary_button/enabled/loading/ds_secondary_button_enabled_loading_step_3.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/disabled/ds_tertiary_button_disabled.png b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/ds_tertiary_button_disabled.png new file mode 100644 index 00000000..153a8e01 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/ds_tertiary_button_disabled.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_0.png new file mode 100644 index 00000000..5ca1cd57 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_1.png new file mode 100644 index 00000000..8227d8dc Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_2.png new file mode 100644 index 00000000..2dec81d4 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_3.png new file mode 100644 index 00000000..6d11b693 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/disabled/loading/ds_tertiary_button_disabled_loading_step_3.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/enabled/ds_tertiary_button_enabled.png b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/ds_tertiary_button_enabled.png new file mode 100644 index 00000000..db998e7a Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/ds_tertiary_button_enabled.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_0.png b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_0.png new file mode 100644 index 00000000..f1976bf9 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_0.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_1.png b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_1.png new file mode 100644 index 00000000..aa73d703 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_1.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_2.png b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_2.png new file mode 100644 index 00000000..37c78216 Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_2.png differ diff --git a/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_3.png b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_3.png new file mode 100644 index 00000000..952f07dc Binary files /dev/null and b/test/widgets/buttons/goldens/ds_tertiary_button/enabled/loading/ds_tertiary_button_enabled_loading_step_3.png differ diff --git a/test/widgets/chat/ds_chat_test.dart b/test/widgets/chat/ds_chat_test.dart new file mode 100644 index 00000000..562c386e --- /dev/null +++ b/test/widgets/chat/ds_chat_test.dart @@ -0,0 +1,45 @@ +import 'package:blip_ds/blip_ds.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +import 'ds_chat_test.util.dart'; + +void main() { + group( + 'Delivery Report Icon', + () { + testGoldens( + 'Delivery report should match golden image', + (tester) async { + final builder = DSChatTestUtils.createDeliveryReportIconScenarios(); + + await tester.pumpWidgetBuilder(builder.build()); + + await screenMatchesGolden( + tester, + DSChatTestUtils.deliveryReportIconGoldenPath, + autoHeight: true, + ); + }, + ); + + testWidgets( + 'Delivery report failed message should be displayed when status is failed or unknown', + (tester) async { + final messages = DSChatTestUtils.buildDeliveryReportIcon( + deliveryStatus: DSDeliveryReportStatus.failed, + ); + + await tester.pumpWidgetBuilder(messages); + + final Finder findMessage = find.text( + 'Falha ao enviar mensagem.', // TODO: translate + findRichText: true, + ); + + expect(findMessage, findsOneWidget); + }, + ); + }, + ); +} diff --git a/test/widgets/chat/ds_chat_test.util.dart b/test/widgets/chat/ds_chat_test.util.dart new file mode 100644 index 00000000..1c940fea --- /dev/null +++ b/test/widgets/chat/ds_chat_test.util.dart @@ -0,0 +1,59 @@ +import 'package:blip_ds/src/enums/ds_delivery_report_status.enum.dart'; +import 'package:blip_ds/src/widgets/chat/ds_delivery_report_icon.widget.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +class DSChatTestUtils { + static const deliveryReportIconGoldenPath = + 'ds_delivery_report_icon/ds_delivery_report_icon'; + static const unsupportedContentGoldenPath = + 'ds_unsupported_content_message_bubble/ds_unsupported_content_message_bubble.'; + + static GoldenBuilder createDeliveryReportIconScenarios() { + final builder = GoldenBuilder.column(); + + builder.addScenario( + 'DSDeliveryReportStatus - Accepted', + buildDeliveryReportIcon( + deliveryStatus: DSDeliveryReportStatus.accepted, + ), + ); + + builder.addScenario( + 'DSDeliveryReportStatus - Consumed', + buildDeliveryReportIcon( + deliveryStatus: DSDeliveryReportStatus.consumed, + ), + ); + + builder.addScenario( + 'DSDeliveryReportStatus - Received', + buildDeliveryReportIcon( + deliveryStatus: DSDeliveryReportStatus.received, + ), + ); + + builder.addScenario( + 'DSDeliveryReportStatus - Failed', + buildDeliveryReportIcon( + deliveryStatus: DSDeliveryReportStatus.failed, + ), + ); + + builder.addScenario( + 'DSDeliveryReportStatus - Unknown', + buildDeliveryReportIcon( + deliveryStatus: DSDeliveryReportStatus.unknown, + ), + ); + + return builder; + } + + static DSDeliveryReportIcon buildDeliveryReportIcon({ + required final DSDeliveryReportStatus deliveryStatus, + }) { + return DSDeliveryReportIcon( + deliveryStatus: deliveryStatus, + ); + } +} diff --git a/test/widgets/chat/goldens/ds_delivery_report_icon/ds_delivery_report_icon.png b/test/widgets/chat/goldens/ds_delivery_report_icon/ds_delivery_report_icon.png new file mode 100644 index 00000000..57c86985 Binary files /dev/null and b/test/widgets/chat/goldens/ds_delivery_report_icon/ds_delivery_report_icon.png differ