アプリ関連ニュース

Getting Hostname in Laravel

We have to catch your domain name, hostname and url segments and use it back in your projects frequently. Today I will share a few functions to get it done easily in Laravel Framework.

getHttpHost

request()->getHttpHost(); //return domain.com

This will return the domain name like this.

request()->getHost(); // return domain.com

This also works same with above method.

getSchemeAndHttpHost

If you want to get http segments along with the domain name. You can use getSchemeAndHttpHost method.

request()->getSchemeAndHttpHost(); // return https://domain.com

url

Using the url method, you can get the current route path like this.

url()->current(); // return current existing url

You can also use request()->url() to return the url address along with http.

segment

If you need to parse your routing url , the segment will help to parse it. For example this is our current url domain.com/blog/hello

request()->segment(0); // return blog
request()->segment(1); // return hello 

The methods I wrote above are some of the useful functions if you have to deal with your URL address or hostname.

Yuuma



Flutter – Aspect Ratio Widget

These days I studies flutter widgets a lot. From these studies, I would like to share you one thing – this is the importance of aspect ratio and how to use this widget.

Care about proportions more than exact dimensions?

When laying out your app, you often don’t care about the exact dimensions of which it will take. But you do care about the aspect ratio. You want the widget to be this wide irrespective of the actual dimensions or you want it to be slim or exactly square. Flutter solves this by providing the Aspect Ratio widget.

AspectRatio()

you give it an AspectRatio, a child, and, well , that’s it.

AspectRatio(
 aspectRatio: 3 / 2,
child:  MyWidget(),
)

Aspect ratio is the ratio between the width and height of a box. It’s often written as a fraction, like 3/2, as in three parts of width to two parts of height. But let’s not kid ourselves – it’s really just a double: 3 over 2 is just 3 divided by 2, which is 1.5 – the same thing.

AspectRatio(
 aspectRatio: 1.5,
child:  MyWidget(),
)

But don’t worry! Dart is smart enough to do the computation for you during compilation. So it’s okay and more readable to provide the aspect ratio as a fraction.

And one more thing – make sure you actually let the AspectRatio widget size it’s child. If you put AspectRatio into something like Expanded, then that will be forced by it’s parent to expand.

Expanded(
 child: AspectRatio(
  aspectRatio: 3 / 2,
  child: MyWidget(),
 ),
)

Tightly fitted widgets like Expanded don’t give their children a choice- harsh. If this happens to you, just put something like Align between the Expanded and the AspectRatio.

Expanded(
 child: Align(
 alignment: Alignment.bottomCenter,
  child: AspectRatio(
   aspectRatio: 3 / 2,
   child: MyWidget(),
  ),
 ),
)

Align will be forced by Expanded to fill the area. But it will let it’s child assume it’s own proportions.

Hope you enjoyed the article!

By Ami



Flutterを使ってAndroidアプリを作ろう

前回まででFlutterプロジェクトを作成することができるようになったので、
メニューからFlutterのプロジェクトを作成します。

続きを読む

Flutterの開発環境を構築しよう

MacにAndroidStudioをインストールして、
Flutterのプロジェクトを作成することができるまでをご紹介します。

続きを読む

Rare HTML tags you mightn’t notice

Today I will talk about some html tags which are not very well-known but of course they are so useful if you know them. So lets get started.

<s> tag

S tag similar to the line-through value of a text decoration CSS property. This is very useful when you need to represent content that is no longer relevant or valid.

Price - <s>100</s>
<p>Discount Price - 70<p>

<ruby>, <rt>, and <rp> tags

The Ruby <ruby> HTML element represents small annotations that are rendered above, below, or next to base text, usually used for showing the pronunciation of East Asian characters.

The HTML Ruby fallback bracket () element is used to provide fallback brackets to browsers that do not support the display of ruby annotations using the element.

<ruby>
  お休み <rp>(</rp><rt>Oyasumi</rt><rp>)</rp>
</ruby>

<detail> Tag

This tag is used to specify additional details that the user can show or hide on click.

<details>
<summary>Click</summary>
<p>Helo</p>
</details>

<abbr> tag

The tag displays the full meaning of the abbreviation when the user hovers the cursor over the abbreviation.

<p>My name is <abbr title="Hlaing Tin Htun">Hlaing</abbr> </p>

Well , there are some other interesting tags you probably don’t know yet. Discovering them might be very useful in our daily works relating with creating HTML elements.

Yuuma



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム