アプリ関連ニュース
- 2021年8月20日
- 技術情報
Flutter – Physical Model

All of the best app start with a square, squarely in the middle of the screen. But to turn this abstract idea into something more real we need to think outside the box.
All of the best app start with a square, squarely in the middle of the screen. But to turn this abstract idea into something more real we need to think outside the box.
If you look at the real physical box the only way you’re able to see it with some light, and that light casts a shadow. What if we want our abstract boxes to have a real shadow? Just like a real box. So that our users have a mental model for what the things in your app are.
Well, that’s what a Physical Model is for. Just take whatever widget you’re working with, wrap it inside of a Physical Model and give it a color.
PhysicalModel(
child: BlueBox(),
color: Colors.black,
)
Wait! There is no shadow. By default Physical Model’s elevation is zero, so we need to pick that box up to be able to see the shadow.
PhysicalModel(
child: BlueBox(),
color: Colors.black,
elevation: 8.0
)
But unlike the real world we have additional options, for our Physical model’s shadows, like it’s color.
PhysicalModel(
child: BlueBox(),
color: Colors.black,
shadowColor: Colors.pink,
elevation: 8.0,
)
You can also change the roundness of the shadow’s corners.
PhysicalModel(
child: BlueBox(),
color: Colors.black,
shadowColor: Colors.pink,
elevation: 8.0,
borderRadius:
BorderRadius: circular(45),
)
or simply update what shape it takes.
PhysicalModel(
child: BlueBox(),
color: Colors.black,
shadowColor: Colors.pink,
elevation: 8.0,
shape: BoxShape.circle,
)
Physical Model is super useful, when you have ideas for custom shadow effects, it’s also used under the hood in widgets like Material to build material shadow.
Let’s create simple Physical model!! The result screenshoot is at the top.
return Scaffold(
body: Center(
child: PhysicalModel(
elevation: 20.0,
shadowColor: Colors.red,
color: Colors.red,
child: Container(
width: 200,
height: 200,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.red,
width: 1.0,
),
),
),
),
),
);
Hope you enjoyed this post!
By Ami
asahi at 2021年08月20日 10:00:32
- 2021年8月19日
- Unity
[Unity] カメラに追従するGameObjectと複製(2)
nishida at 2021年08月19日 10:00:53
- 2021年8月12日
- Unity
[Unity] カメラに追従するGameObjectと複製(1)
nishida at 2021年08月12日 10:00:51
- 2021年8月09日
- 技術情報
Git tricks you should know
We use version control system to manage and gather our source codes, right. I am pretty sure most of us are using Git for version control system nowadays. Today, I will share with you some git commands that will help you to improve your git knowledge.
Remove all your local git branches except master
You may have many local branches while you are on developments. But one day, you may want to get rid of these local branches and keep only main/master branch. This command will help you.
git branch | grep -v "main" | xargs git branch -D
Undo last commit
If you want to undo your most recent commit. Follow these steps.
git commit -m "undo message"
Then reset our changes
Pretty git log format
git reset HEAD~
Normally we use to see our git log activity using git log. But we can see better with pretty formatting using this.
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
Deleting git branch
I wrote deleting local branches except main/master in above. In here, I will talk about deleting a specific branch both on local and remote.
Deleting on local
git branch -d <branch_name>
Deleting on remote
git push <remote> --delete <branch_name>
Cherry picking from another repository
We can apply the changes from another repository to us also.
git fetch <remote-url> <branch_name> && git cherry-pick SHA1
I’m pretty sure there are other useful tricks as well. That’s all for now.
Yuuma
yuuma at 2021年08月09日 10:30:19
- 2021年8月02日
- 技術情報
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
yuuma at 2021年08月02日 10:30:20