Skip to content

flex message simulator example

찰스 edited this page Jul 21, 2023 · 14 revisions

Restaurant

var request = new FlexMessage()
{
    AltText = "flex restaurant message test",
    Contents = new Bubble()
    {
        Hero = new ImageComponent()
        {
            Url = "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png",
            Size = "full",
            AspectRatio = "20:13",
            AspectMode = AspectModeType.Cover,
            Action = new UriAction()
            {
                Uri = "http://linecorp.com/"
            }
        },
        Body = new BoxComponent()
        {
            Layout = BoxLayoutType.Vertical,
            Contents = new List<IComponent>()
                        {
                            new TextComponent()
                            {
                                Text = "Brown Cafe",
                                Weight = WeightType.Bold,
                                Size = "xl"
                            },
                            new BoxComponent()
                            {
                                Layout = BoxLayoutType.Baseline,
                                Margin = "md",
                                Contents = new List<IComponent>()
                                {
                                    new IconComponent()
                                    {
                                        Size = "sm",
                                        Url = "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
                                    },
                                    new IconComponent()
                                    {
                                        Size = "sm",
                                        Url = "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
                                    },
                                    new IconComponent()
                                    {
                                        Size = "sm",
                                        Url = "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
                                    },
                                    new IconComponent()
                                    {
                                        Size = "sm",
                                        Url = "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png"
                                    },
                                    new IconComponent()
                                    {
                                        Size = "sm",
                                        Url = "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png"
                                    },
                                    new TextComponent()
                                    {
                                        Text = "4.0",
                                        Size = "sm",
                                        Color = "#999999",
                                        Margin = "md",
                                        Flex = 0
                                    }
                                }
                            },
                            new BoxComponent()
                            {
                                Layout = BoxLayoutType.Vertical,
                                Margin = "lg",
                                Spacing = "sm",
                                Contents = new List<IComponent>()
                                {
                                    new BoxComponent()
                                    {
                                        Layout = BoxLayoutType.Baseline,
                                        Spacing = "sm",
                                        Contents = new List<IComponent>()
                                        {
                                            new TextComponent()
                                            {
                                                Text = "Place",
                                                Color = "#aaaaaa",
                                                Size = "sm",
                                                Flex = 1
                                            },
                                            new TextComponent()
                                            {
                                                Text = "Miraina Tower, 4-1-6 Shinjuku, Tokyo",
                                                Wrap = true,
                                                Color = "#666666",
                                                Size = "sm",
                                                Flex = 5
                                            }
                                        }
                                    }
                                }

                            },
                            new BoxComponent()
                            {
                                Layout = BoxLayoutType.Baseline,
                                Spacing = "sm",
                                Contents = new List<IComponent>()
                                {
                                    new TextComponent()
                                    {
                                        Text = "Time",
                                        Color = "#aaaaaa",
                                        Size = "sm",
                                        Flex= 1
                                    },
                                    new TextComponent()
                                    {
                                        Text =  "10:00 - 23:00",
                                        Wrap = true,
                                        Color = "#666666",
                                        Size = "sm",
                                        Flex = 5
                                    }
                                }
                            }
                        }
        },
        Footer = new BoxComponent()
        {
            Layout = BoxLayoutType.Vertical,
            Spacing = "sm",
            Contents = new List<IComponent>()
                        {
                            new ButtonComponent()
                            {
                                Style = ButtonStyleType.Link,
                                Height = "sm",
                                Action = new UriAction()
                                {
                                    Label = "CALL",
                                    Uri = "https://linecorp.com"
                                }
                            },
                            new ButtonComponent()
                            {
                                Style = ButtonStyleType.Link,
                                Height = "sm",
                                Action = new UriAction()
                                {
                                    Label = "WEBSITE",
                                    Uri = "https://linecorp.com"
                                }
                            },
                            new BoxComponent()
                            {
                                Layout = BoxLayoutType.Vertical,
                                Contents = new List<IComponent>(),
                                Margin = "sm"
                            }
                        },
            Flex = 0
        },
    },
};
Clone this wiki locally